Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

runas: I can't invoke system commands

Writer Olivia Zamora

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

enter image description here

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.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy