1.

Solve : Inputting username and password on one line?

Answer»

hi,

I want to be able to input the username and password within dos on one LINE. Basically, whenver i am in dos, and i am prompted for a password, i don't have to type the password on a seperate line.

For example, instead of:

Code: [Select]C:\> 'runas /user:home\yazooney explorer.exe'
Enter the password for home\yazooney: 'PASSWORD'
I want to be able to do:
Code: [Select]C:\> 'runas /user:home\yazooney explorer.exe & PASSWORD'
However, using the & FUNCTION for doing mulitple commands on one line does not work.

Anyone know a way of solving this problem?the 'run as' command won't let you automate the password.

You will HAVE to enter it manually. (it's a security thing....)


you could use pstools, that will allow the password to be entered on the same line.


hope it helps.

** my 2 cents **Thanks for the reply. Currently having a look at this pstools thing. As you can imagine, i not that MUCH clued up.

Any chance you can give me an example of how this would work?sure;

in a dos prompt navigate to the pstools folder and run;

"start psexec C:\path\to\program -u username - password"

it's mainly used for running apps on remote machines but I see no reason why it won't run locally.

You might have to put in \\%localhost% between the psexec and the path to program bit.

I would have thought you could echo the password but just PIPE it into the runas command, like this:

Code: [Select]echo PASSWORD | runas /user:admin cmd.exe
I didn't try it but it should work, I think...



Discussion

No Comment Found