0

Of course, if possible, without any VBScript-like scripts.

double-beep
  • 5,031
  • 17
  • 33
  • 41
Lastnico
  • 1,473
  • 11
  • 13

2 Answers2

4

Lastnico,

Hello, I think I have a solution to your problem. Try the following:

Try this at your command prompt:

C:\> cmd /c exit /b 4

C:\> echo %errorlevel%

The result should be 4.

Here is a screen shot of my result:

Result of Code http://img691.imageshack.us/img691/7473/cmdc.jpg

I hope this helps,

Thanks!

Community
  • 1
  • 1
Scott
  • 2,183
  • 18
  • 33
1

The exit code is stored in the ERRORLEVEL environment variable:

echo %ERRORLEVEL%

To test it you can create a simple batch file that exits using the exit code passed as parameter:

exit_code.bat

@exit /b %1

Testing:

> exit_code.bat 8
> echo %ERRORLEVEL%
8
Kaniabi
  • 530
  • 5
  • 10