You seem to misunderstand. I'm using an incorrect password on purpose to see if runas returns the error code. As you can see in the output it returns an error to the stdout but does not return that error to Kix.

I want to use Runas in a script I'm writing and I'd like to stop execution of the script if it fails to login correctly. As it stands there appears (unless anyone knows a way) no simple way of doing this.

In addition, here's another test I tried this time trying to run an executable that doesn't exist:
Example
code:
shell '.\runas /user:administrator /pass:HIDDEN /w nonexistent.exe'
? @ERROR " " @SERROR

Output:
code:
Attempting to start "nonexistent.exe" as user "MR-3211\administrator"...
RUNAS ERROR: Unable to run
2 - The system cannot find the file specified.


0 The operation completed successfully.

As you can see, there is still on error returned.

[ 05. November 2003, 12:32: Message edited by: barkingstars ]