Why doesn’t the RunAs program accept a password on the command line?

Raymond Chen

The RunAs program demands that you type the password manually. Why doesn’t it accept a password on the command line?

This was a conscious decision. If it were possible to pass the password on the command line, people would start embedding passwords into batch files and logon scripts, which is laughably insecure.

In other words, the feature is missing to remove the temptation to use the feature insecurely.

If this offends you and you want to be insecure and pass the password on the command line anyway (for everyone to see in the command window title bar), you can write your own program that calls the CreateProcessWithLogonW function.

(I’m told that there is a tool available for download which domain administrators might find useful, though it solves a slightly different problem.)

0 comments

Discussion is closed.

Feedback usabilla icon