1.

Solve : I need help with outputting data from a runas command?

Answer»

As the subject states I need some help with outputting whats printed to the Dos screen after the runas command is executed. Now I can get it to output...
"Enter the password for Guest\ADMIN: "
...but thats not what I want it to output I want it to output the data on if the password entered was correct, if it could run what it was told to run and if not what was the error it came across and I want all this printed into "Text.txt". Thanks for any and all help.So you're looking for something to output the command to a text file??

You might want to have a look at this: >>

For example: dir C:\ >>"C:\Documents and Settings\%username%\Desktop\file.txt" will output the results for the Dir to a text file.Well I use the ">>" but all they will out put of the runas command is...
"Enter the password for Guest\admin: "
...which is not what I want outputted. This is what I have.
Code: [Select]@echooff
ECHO ****** | runas /noprofile /env /netonly /user:***\Admin MozillaFireFox.exe >> Text.txt
pauseEvery time it runs threw fine but when it outputs the data all I get is "Enter the password for Guest\admin: ".i dont think thats possible because you are using a file pipe, i could be wrong*censored*, can any one else confirm or DENY this?Wait...Do you want:
echo ****** | runas /noprofile /env /netonly /user:***\Admin MozillaFireFox.exe
in a text file?

If so, you need 2 echos.
Code: [Select]echo echo ****** | runas /noprofile /env /netonly /user:***\Admin MozillaFireFox.exe >>"C:\text file.txt"No, I need to now whats printed to the screen after that command is executed. So say I do...
Code: [Select]echo ****** | runas /profile /env /netonly /user:***\Admin MozillaFireFox.exe...now since most of you already know that you cant use "/profile" and "/netonly" in the same line of code it would GIVE me an error or print the huge help thing on the runas command I would want all of that outputted to a text file.Hmmm....If you can see all of that in the Command Prompt Window, you can right click on the CMD window and click Edit --> Mark and then highlight everything. Then go back to Edit --> Copy and then paste it into notepad.

Kind of ruins the point, but thanks for all the help any way!Just a hunch, but try redirecting the STDERR stream to your text file.

Code: [Select]runas /profile /env /netonly /user:***\Admin MozillaFireFox.exe 2>file.txt

As far as I know, you cannot pipe the password to the runas command. Besides being a security breach, not all programs can accept input from the pipe.



Oh, I can pipe the password to the runas command just fine its just outputting the information to a text document that its not liking. Thanks for the INFO on not all programs accepting input from a pipe though.



Discussion

No Comment Found