Search code examples
winapicreateprocessrunas

windows Runas always returns "The System cannot find the file specified"


Windows runas.exe application does not work when I use the same syntax shown in runas /?. For example one of the usages shown is, runas /trustlevel<TrustLevel> program, however, when I use runas /trustlevel<0x20000> calc I get "The system cannot find the file specified." What file is it talking about?

I noticed another person asked similar question but they were trying to use console program written using Delphi: Got "The system cannot find the file specified" when I run NETSH from CreateProcess but it works ok on Command Prompt? but I am using DOS command in Windows so I don't understand why the same command would run fine if I type in command prompt or Start Menu->Run or Taskmanager->File->Run but won't work when I use runas.


Solution

  • < and > is the input and output redirection operators in cmd.exe. /trustlevel<0x20000> is asking cmd.exe to read from a file called 0x20000.

    The correct syntax is runas /trustlevel:0x20000 calc.

    The <something> syntax in help output means the parameter is required. [something] is optional.

    /trustlevel does not change the UAC integrity level so it is not a good way to reduce your rights although it will add a deny-only SID for the administrators group so it is probably implemented with the Safer API.