On my computer, I have two admin accounts. The default admin account named "Administrator", and a new admin account named "testadmin." If I run the following commands: runas /user:testadmin cmd.exe
Is it possible to automate the password entering? Yes, but every method you want to use will somehow store the password, such that a clever user may be able to retrieve it. One way to do it, is by storing the password in a textfile along with an enter (new line) and then use the command as follows: runas /user:localadmin "c:\users\localuser\desktop\control.exe" < password.txt What this does is ...
For anyone stumbling upon this while searching for a way to use runas with an application where its own parameters may contain spaces. The original accepted answer with " did not work for me. What works is to put a double quote to actually be able to pass arguments with spaces: runas.exe /user:domain\username "perfmon.exe ""argument with spaces"" /res" It is actually explained quite nicely ...
I had a script that needed to run as an administrator but then run a single command in a non-elevated context. I was previously doing it with runas /trustlevel:0x20000 program.exe, but after updating
The runas is supposed to ask for the password before running the batch file. Does this username have a password? Does it work from an elevated CMD?
Using “runas /user” to run a batch file and seemingly nothing happens
The script then creates a temporary scheduled task named RunAs_LocalSystem_$(New-Guid), which is set to run as NT AUTHORITY\SYSTEM. Finally, the script runs the scheduled task, then deletes it.