This works:
$ C:\Users\Guest> runas /user:Administrator cmd Executes a new cmd.exe process/window as Administrator
However using commands like type, cd, echo, dir, etc won't work:
$ C:\Users\Guest> runas /user:Administrator type $ C:\Users\Guest> runas /user:Administrator cd $ C:\Users\Guest> $ C:\Users\Guest> echo "hello" > test $ C:\Users\Guest> runas /user:Administrator "type C:\Users\Guest\test" all of the above give the same error:
RUNAS ERROR: Unable to run - type C:\Users\Guest\test 2: The system can not find the file specified 1 Answer
That is because type and cd are internal commands of the command interpreter, cmd.exe.
Use
$ C:\Users\Guest> runas /user:Administrator "cmd /c type \"C:\Users\Guest\test\"" You could call the cd command the same way, but there is no point calling cd in a process that will terminate immediately.
