Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
sacha99
- Posts: 1
- Joined: 23 Jul 2019 08:05
#1
Post
by sacha99 » 23 Jul 2019 08:18
Hello,
I need to change a line in some old scripts from this
to this
Because of this change I need to test the scripts to make sure it doesn't change the output of the scripts. How can I set the errorlevel ? From my search on internet, it seems I cannot change it.
Thank you for your help.
-
aGerman
- Expert
- Posts: 4678
- Joined: 22 Jan 2010 18:01
- Location: Germany
#2
Post
by aGerman » 23 Jul 2019 13:08
Easiest way to set the errorlevel to a certain value:
Steffen
-
dbenham
- Expert
- Posts: 2461
- Joined: 12 Feb 2011 21:02
- Location: United States (east coast)
#3
Post
by dbenham » 23 Jul 2019 13:47
sacha99 wrote: ↑23 Jul 2019 08:18
I need to change a line in some old scripts from this
to this
In case you don't know, those two statements give entirely different results.
IF NOT ERRORLEVEL 0 only returns TRUE if ERRORLEVEL is less than 0. It returns FALSE if greater than or equal to 0.
IF %ERRORLEVEL% NEQ 0 returns TRUE if ERRORLEVEL is greater than 0
or less than 0. It only returns FALSE if exactly 0.
Dave Benham