Here is my pseudo:
Read from LIST
Ping to check if machine is awake | Report result
Check to see if SERVICE is running | Report result
NO? Is it stopped?
YES? Run it | Report result
NO? Must not be installed, remote install please! | Report result
This is driving me bonkers here... I can make the parts of this code work alone just fine, but when I combine it into a nested IF structure, it returns 'Network Error' and 'Running' if a machine does not have the service running...then a manual check at that machine shows it is still actually stopped. Same for machines without the service installed at all.Please tell me where I'm messing up.. Thanks!
#echo off
echo.
echo.
cls
set SERVICE=MyServ
for /f %%i in (\\127.0.0.1\c$\list.txt) do call :DOIT %%i
:DOIT
echo Checking %SERVICE% on %1
#ECHO off
ping -n 2 -w 1000 %1 >trial.txt
find "Reply from" trial.txt>nul
if %ERRORLEVEL% == 1 (echo %1 Network Unresponsive>> "\\127.0.0.1\c$\list_report.txt")
if %ERRORLEVEL% == 0 (
sc \\%1 query %SERVICE% | FIND "STATE" | FIND "RUNNING"
if %ERRORLEVEL% == 0 (echo %1 Running>> "\\127.0.0.1\c$\list_report.txt")
if not %ERRORLEVEL% == 0 (
sc \\%1 query %SERVICE% | FIND "STATE" | FIND "STOPPED"
if %ERRORLEVEL% == 0 (
sc \\%1 start %SERVICE%
echo %1 forced start>> "\\127.0.0.1\c$\list_report.txt""
)
if not %ERRORLEVEL% == 0 (
xcopy /f /y "\\127.0.0.1\!\theAPP.exe" "\\%1\c$\temp\"
\\127.0.0.1\!\psexec \\%1 -s -n 10 -d cmd /c "c:\temp\theAPP.exe"
echo %1 Installed>> "\\127.0.0.1\c$\list_report.txt""
)
)
)
this should fix the issue
for /f %%i in (\\127.0.0.1\c$\list.txt) do call :DOIT %%i
:DOIT
if not "%1"=="" (
echo Checking %SERVICE% on %1
echo.
ping -n 2 -w 1000 %1 | find "Reply from" >nul
if ERRORLEVEL 1 echo %1 Network Unresponsive>> \\127.0.0.1\c$\list_report.txt else (
sc \\%1 query %SERVICE% | find "RUNNING" > nul
if ERRORLEVEL 1 (
sc \\%1 start %SERVICE% > nul
echo %1 Forced Start>> \\127.0.0.1\c$\list_report.txt
) else (
echo %1 Running>> \\127.0.0.1\c$\list_report.txt)
xcopy /f /y \\127.0.0.1\c$\text.txt \\%1\c$\temp\ > nul
\\127.0.0.1\c$\psexec \\%1 -s -n 10 -d cmd /c "type c:\temp\text.txt"
echo %1 Installed>> "\\127.0.0.1\c$\list_report.txt")
)
)
part of the issue is that you have to test for if not %1="" at the top of the script. that is where you get the erroneous text..
then you had some nesting issues, so i used ELSE instead.
you will have to change the text.txt to your filename.exe (and omit the "type" command)
please check answer if this solves your problem
fyi, you will need to have administrator access on the remote machine so that you can turn on and off services
Related
Have tried different approaches to make the SSMs job working with SCP command with perl script. but the job is going into loop with out having a result.
PS : The script is working fine with running from command prompt directly.
command used in the perl script:-
$Command = "scp -i D:\File1\RS2\DataFeed\Code\PrivateKey.ppk -s $InternalFile admin#sftp.world.com:$VendorName/$DestFileName";
system command used in perl
system($command);
While running the command directly from windows cmd it is correctly placing file to the SFTP. but while running this perl script from ssms agent job it seems not working and the job is keep running without any results.
Any possible leads to the actual errors will be much appreciated
Detailed Steps :
Job in SSMS :
Step :
DataFeed.cmd
%_Debug% echo off
cd /d %0\..
pushd .
setlocal
rem -----------------------------------------------------------------
rem Localize environment
rem -----------------------------------------------------------------
if exist DataFeed_Environment.cmd (
call DataFeed_Environment.cmd
) else (
echo DataFeed_Environment.cmd not found!!!
echo
goto CmdUsage
)
rem -----------------------------------------------------------------
rem Run perl package
rem -----------------------------------------------------------------
C:\Perl\bin\perl.exe DataFeedProd1.pl
if %ERRORLEVEL% NEQ 0 goto ErrorExit
goto Exit
rem -----------------------------------------------------
rem Command Usage
rem -----------------------------------------------------
:CmdUsage
Echo ---------------------------------------------------------------------
echo.
echo DataFeed.cmd
echo Wraps the call to DataFeed.pl,
echo mails log upon errors.
echo.
echo Usage:
echo DataFeed.cmd
echo.
echo ----------------------------------
rem endlocal
rem popd
rem exit 1
rem -----------------------------------------------------------------
rem Error exit
rem -----------------------------------------------------------------
:ErrorExit
echo DataFeedProd1.pl failed !!!
echo
rem endlocal
rem popd
rem exit 1
rem -----------------------------------------------------------------
rem Exit
rem -----------------------------------------------------------------
rem endlocal
rem popd
:Exit
rem exit 0
sub CopyDataFeedFileToSftp{
my ($DataFeedFileInternal, $DataFeedVendorName,$DataFeedFileName) = #_;
my($DestFileName)=$DataFeedFileName.".zip";
my($Command);
my($RetValue) = 1;
$Command = "C:\\Users\\hprasu\\Downloads\\OpenSSH-Win64\\scp.exe -i D:\\File1\\RS2\\DataFeed\\Code\\PrivateKey.ppk -s $DataFeedFileInternal a_Tne\#nasftp\.egencia.com:$DataFeedVendorName/$DestFileName";
$RetVal = &CallSystem($Command);
if ($RetVal == 0) {
&AppendFileToLog($TempFile);
&ErrorExit("Unable to copy data feed file using SCP command:\n".$Command);
}
}
The above perl method is executing the System command
You should:
have full path to perl.exe and your perl script in job's command
escape all special characters in interpolated strings for Perl and
use full path for scp command since
operating system don't know where scp.exe is located (until it in the $PATH):
check filesystem permissions for all files in the command and perl script. Job should has access those files.
So command would be
$Command = "full_path\\scp.exe -i D:\\File1\\RS2\\DataFeed\\Code\\PrivateKey.ppk -s $InternalFile admin\#sftp.world.com:$VendorName/$DestFileName";
Read this:
https://www.geeksforgeeks.org/perl-quoted-interpolated-and-escaped-strings/
I wrote a script that's executed by Task Scheduler every night at 23:00 to have NAS01 power on NAS02 if it's not already on, execute a GoodSync job to backup NAS01, and shutdown NAS02 upon completion. The script isn't pretty, but it does the job. The issue that I have is the timestamps. I set variables to set the format for the date and time, however, this will just reference the timestamp of the variable for the entire script. How do I keep the formatting, but be able to get the date and time at each point it's called?
As you can see from the script, there's a date/time format for the log filename, and a date/time format for the logging within the log file. What happens in my formatting:
Forced 24H time
Leading space in the hour is replaced with a '0' (IE " 6:30" becomes "06:30")
Time fomatting is HHMM for filename and HH:MM:SS for logging
Date formatting is YYYYMMDD for filename and YYYY/MM/DD for logging
Script:
#ECHO off
REM Change CMD window color and size.
color 37
mode 180,50
REM ### Set variables
SET IPADDRESS1=11.11.11.20
SET IPADDRESS2=10.0.3.1
SET HH=%time:~-11,2%
SET MM=%time:~-8,2%
SET SS=%time:~-5,2%
SET NAMETIMESTR=%HH: =0%%MM%
SET LOGTIMESTR=%HH: =0%:%MM%:%SS%
SET MYDATE=%DATE:~4,10%
SET NAMEDATESTR=%MYDATE:~6,4%%MYDATE:~0,2%%MYDATE:~3,2%
SET LOGDATESTR=%MYDATE:~6,4%/%MYDATE:~0,2%/%MYDATE:~3,2%
SET LOGFILE=C:\!SCRIPTS\logs\7xNAS02-GSync-%NAMEDATESTR%_%NAMETIMESTR%.txt
:START
REM ### Checks IF 7xNAS02 is online. IF not, power it on.
ECHO ################################################################################################################################ >> %LOGFILE%
ECHO %LOGDATESTR% %LOGTIMESTR% EXECUTING GSYNC SCRIPT >> %LOGFILE%
ECHO ################################################################################################################################ >> %LOGFILE%
ECHO.
ECHO This is an automated script to backup the storage array on 7xNAS01 onto 7xNAS02.
ECHO IF 7xNAS02 isn't powered on, the script will boot 7xNAS02, wait for it to come online,
ECHO and then execute the "STORAGE" backup job in GoodSync.
ECHO.
ECHO %LOGDATESTR% %LOGTIMESTR% Checking power status of 7xNAS02... >> %LOGFILE%
ECHO Checking power status of 7xNAS02...
ECHO.
ping -n 1 %ipaddress1% | findstr TTL && GOTO ALREADY_ON
ping -n 1 %ipaddress1% | findstr TTL || GOTO POWER_ON
:ALREADY_ON
REM Sets variable to dictate that the server was already on before executing the script.
ECHO.
ECHO %LOGDATESTR% %LOGTIMESTR% 7xNAS02 is already powered on and available. >> %LOGFILE%
ECHO 7xNAS02 is already powered on and available.
ECHO.
SET previously_off=1
GOTO EXECUTE_BACKUP
:POWER_ON
REM ### Powers on 7xNAS02
ECHO %LOGDATESTR% %LOGTIMESTR% 7xNAS02 is offline. Powering on now. >> %LOGFILE%
ECHO 7xNAS02 is offline. Powering on now.
ECHO.
SET previously_off=0
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'C:\!SCRIPTS\7xNAS02-Power-On.ps1'" >> %LOGFILE%
ECHO %LOGDATESTR% %LOGTIMESTR% Pinging 7xNAS02 until it's available... >> %LOGFILE%
ECHO Pinging 7xNAS02 until it's available...
ECHO.
GOTO CHECK_IF_READY
:CHECK_IF_READY
REM ### Continually pings 7xNAS02 until it is online.
ping -n 1 %ipaddress1% | findstr TTL || GOTO CHECK_IF_READY
ping -n 1 %ipaddress1% | findstr TTL && GOTO EXECUTE_BACKUP
:EXECUTE_BACKUP
REM ### Executes GoodSync backup job, "STORAGE."
ECHO %LOGDATESTR% %LOGTIMESTR% Executing "STORAGE" backup job. >> %LOGFILE%
ECHO Executing "STORAGE" backup job.
ECHO.
C:\"Program Files"\"Siber Systems"\Goodsync\gsync sync "STORAGE" >> %LOGFILE%
IF %previously_off% == 0 (
ECHO.
ECHO %LOGDATESTR% %LOGTIMESTR% Sync job done. Shutting down 7xNAS02... >> %LOGFILE%
ECHO Sync job done. Shutting down 7xNAS02...
shutdown /m \\7xNAS02 /s /f /d p:0:0 /c "Executed by 7xNAS02-GSync-Script on 7xNAS01."
GOTO SHUTDOWNCHECK
)
IF %previously_off% == 1 (
ECHO.
ECHO %LOGDATESTR% %LOGTIMESTR% Sync job done. 7xNAS02 will stay powered on. >> %LOGFILE%
ECHO Sync job done. 7xNAS02 will stay powered on.
ECHO.
)
GOTO END
:SHUTDOWNCHECK
ping -n 5 %ipaddress1% >nul
IF ERRORLEVEL 1 (
REM ### 7xNAS02 has powered off.
ECHO.
ECHO %LOGDATESTR% %LOGTIMESTR% 7xNAS02 has powered off. >> %LOGFILE%
ECHO 7xNAS02 has powered off.
GOTO END
)
REM ### 7xNAS02 is still on. Looping to check IF the server has shut down.
ECHO ...
GOTO SHUTDOWNCHECK
:END
REM pause
ECHO %LOGDATESTR% %LOGTIMESTR% END OF SCRIPT >> %LOGFILE%
exit
EDIT: Thanks to #Mofi, the updated and working script is below.
#ECHO off
REM Change CMD window color and size.
color 37
mode 180,50
REM ### Set variables
SET IPADDRESS1=11.11.11.20
SET IPADDRESS2=10.0.3.1
CALL :GETDATETIME
SET LOGFILE=C:\!SCRIPTS\logs\7xNAS02-GSync-%NAMEDATESTR%_%NAMETIMESTR%.txt
:START
REM ### Checks IF 7xNAS02 is online. IF not, power it on.
ECHO ################################################################################################################################ >> %LOGFILE%
CALL :GETDATETIME
ECHO %LOGDATESTR% %LOGTIMESTR% EXECUTING GSYNC SCRIPT >> %LOGFILE%
ECHO ################################################################################################################################ >> %LOGFILE%
ECHO/
ECHO This is an automated script to backup the storage array on 7xNAS01 onto 7xNAS02.
ECHO IF 7xNAS02 isn't powered on, the script will boot 7xNAS02, wait for it to come online,
ECHO and then execute the "STORAGE" backup job in GoodSync.
ECHO/
CALL :GETDATETIME
ECHO %LOGDATESTR% %LOGTIMESTR% Checking power status of 7xNAS02... >> %LOGFILE%
ECHO Checking power status of 7xNAS02...
ECHO/
ping -n 1 %ipaddress1% | findstr TTL && GOTO ALREADY_ON
ping -n 1 %ipaddress1% | findstr TTL || GOTO POWER_ON
:ALREADY_ON
REM Sets variable to dictate that the server was already on before executing the script.
ECHO/
CALL :GETDATETIME
ECHO %LOGDATESTR% %LOGTIMESTR% 7xNAS02 is already powered on and available. >> %LOGFILE%
ECHO 7xNAS02 is already powered on and available.
ECHO/
SET previously_off=1
GOTO EXECUTE_BACKUP
:POWER_ON
REM ### Powers on 7xNAS02
CALL :GETDATETIME
ECHO %LOGDATESTR% %LOGTIMESTR% 7xNAS02 is offline. Powering on now. >> %LOGFILE%
ECHO 7xNAS02 is offline. Powering on now.
ECHO/
SET previously_off=0
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'C:\!SCRIPTS\7xNAS02-Power-On.ps1'" >> %LOGFILE%
CALL :GETDATETIME
ECHO %LOGDATESTR% %LOGTIMESTR% Pinging 7xNAS02 until it's available... >> %LOGFILE%
ECHO Pinging 7xNAS02 until it's available...
ECHO/
GOTO CHECK_IF_READY
:CHECK_IF_READY
REM ### Continually pings 7xNAS02 until it is online.
ping -n 1 %ipaddress1% | findstr TTL || GOTO CHECK_IF_READY
ping -n 1 %ipaddress1% | findstr TTL && GOTO EXECUTE_BACKUP
:EXECUTE_BACKUP
REM ### Executes GoodSync backup job, "STORAGE."
CALL :GETDATETIME
ECHO %LOGDATESTR% %LOGTIMESTR% Executing "STORAGE" backup job. >> %LOGFILE%
ECHO Executing "STORAGE" backup job.
ECHO/
C:\"Program Files"\"Siber Systems"\Goodsync\gsync sync "STORAGE" >> %LOGFILE%
IF %previously_off% == 0 (
ECHO/
CALL :GETDATETIME
ECHO %LOGDATESTR% %LOGTIMESTR% Sync job done. Shutting down 7xNAS02... >> %LOGFILE%
ECHO Sync job done. Shutting down 7xNAS02...
shutdown /m \\7xNAS02 /s /f /d p:0:0 /c "Executed by 7xNAS02-GSync-Script on 7xNAS01."
GOTO SHUTDOWNCHECK
)
IF %previously_off% == 1 (
ECHO/
CALL :GETDATETIME
ECHO %LOGDATESTR% %LOGTIMESTR% Sync job done. 7xNAS02 will stay powered on. >> %LOGFILE%
ECHO Sync job done. 7xNAS02 will stay powered on.
ECHO/
)
GOTO END
:SHUTDOWNCHECK
ping -n 5 %ipaddress1% >nul
IF ERRORLEVEL 1 (
REM ### 7xNAS02 has powered off.
ECHO/
CALL :GETDATETIME
ECHO %LOGDATESTR% %LOGTIMESTR% 7xNAS02 has powered off. >> %LOGFILE%
ECHO 7xNAS02 has powered off.
GOTO END
)
REM ### 7xNAS02 is still on. Looping to check IF the server has shut down.
ECHO ...
GOTO SHUTDOWNCHECK
:END
REM pause
CALL :GETDATETIME
ECHO %LOGDATESTR% %LOGTIMESTR% END OF SCRIPT >> %LOGFILE%
exit
:GETDATETIME
SET "HH=%time:~-11,2%"
SET "MM=%time:~-8,2%"
SET "SS=%time:~-5,2%"
SET "NAMETIMESTR=%HH: =0%%MM%"
SET "LOGTIMESTR=%HH: =0%:%MM%:%SS%"
SET "MYDATE=%DATE:~4,10%"
SET "NAMEDATESTR=%MYDATE:~6,4%%MYDATE:~0,2%%MYDATE:~3,2%"
SET "LOGDATESTR=%MYDATE:~6,4%/%MYDATE:~0,2%/%MYDATE:~3,2%"
GOTO :EOF
A simple solution for using region dependent but faster accessed DATE and TIME environment variables is the usage of a subroutine.
Append to end of your batch file after last command exit the lines:
:GetDateTime
SET "HH=%time:~-11,2%"
SET "MM=%time:~-8,2%"
SET "SS=%time:~-5,2%"
SET "NAMETIMESTR=%HH: =0%%MM%"
SET "LOGTIMESTR=%HH: =0%:%MM%:%SS%"
SET "MYDATE=%DATE:~4,10%"
SET "NAMEDATESTR=%MYDATE:~6,4%%MYDATE:~0,2%%MYDATE:~3,2%"
SET "LOGDATESTR=%MYDATE:~6,4%/%MYDATE:~0,2%/%MYDATE:~3,2%"
GOTO :EOF
This is the subroutine GetDateTime. And delete the lines at top of your batch file which also set those environment variables.
Above each line using either LOGDATESTR or LOGTIMESTR insert the line:
CALL :GetDateTime
Run in a command prompt window call /? for more information about this method to embed a batch file within a batch file and call it as subroutine.
One more hint: It is recommended to use echo/ instead of echo., see DosTips forum topic: ECHO. FAILS to give text or blank line - Instead use ECHO/
I am trying to write a batch file to automate some routine Matlab processes. The batch file loops through from 0 to a set value (usually between 50 and 75) using the For /L structure. The script copies the main Matlab script to the subfolder and runs it. The batch would normally continue onward so I put a :loop to wait until the Matlab ends.
echo off
setlocal EnableDelayedExpansion
REM The format is matlab_auto.in (max value).
For /L %%G in (0,1,%1) do (
REM Sanity check
echo 1 %%G
REM Create Outputs folder if non-existent
if not exist Outputs md Outputs
REM Copy .m file into deg folder and cd to folder
copy values_calc.m %%Gsort\values_calc.m
cd %%Gsort
echo Got to folder
REM Running .m script and sanity check
echo 2 %%G
matlab -nosplash -nodesktop -noFigureWindows -logfile output.log -r "run('values_calc.m');"
echo 3 %%G
REM Waiting for matlab to finish
:loop
tasklist /fi "imagename eq MATLAB.exe" |find ":" > nul
echo 4 %%G
if errorlevel 1 goto loop
echo Finished Matlab
echo 5 %%G
REM Copy .m outputs into outputs folder, ignoring confirmation
copy Output_*.* ..\Outputs /Y
echo Copied outputs
REM Sanity check and return home
echo 6 %%G
cd %~dp0
echo Home again
)
The problem I'm having is that when it ends after the first iteration of the For loop. Echo 1, 2, 3 are 0. Echo 4 shows 0 the first time through :loop but then it shows %G for the remainder of the loops and at Echos 5 and 6. It also does not continue into further iterations of the For loop. I'm assuming this is because %%G is no longer a number (or in the range specified).
I have tried implementing a call subroutine to use the goto outside the loop but then it opens the Matlab dozens of times, crashing the computer.
Any insight or advice is appreciated. Thank you.
EDIT: Changed the :: for commenting to REM. It did not resolve this issue but looks better.
EDIT 2: I have a test case that demonstrates the problem. Its something with the :loop or goto.
echo off
setlocal EnableDelayedExpansion
for /l %%G in (0,1,5) do (
:loop
echo %%G
pause
if %%G==0 goto loop
)
Yes. The execution of a GOTO command cancel any active (pending) FOR or IF commands that may be nested inside parentheses at any level. This way, the commands placed below the :loop label are executed inside the FOR context the first time, but after the goto command they are executed as if they were placed outside the FOR loop! The way to solve this problem is extracting the code below the label into a subroutine and then call :loop in the FOR.
echo off
setlocal EnableDelayedExpansion
REM The format is matlab_auto.in (max value).
For /L %%G in (0,1,%1) do (
REM Sanity check
echo 1 %%G
REM Create Outputs folder if non-existent
if not exist Outputs md Outputs
REM Copy .m file into deg folder and cd to folder
copy values_calc.m %%Gsort\values_calc.m
cd %%Gsort
echo Got to folder
REM Running .m script and sanity check
echo 2 %%G
matlab -nosplash -nodesktop -noFigureWindows -logfile output.log -r "run('values_calc.m');"
echo 3 %%G
REM Waiting for matlab to finish
call :loop
echo Finished Matlab
echo 5 %%G
REM Copy .m outputs into outputs folder, ignoring confirmation
copy Output_*.* ..\Outputs /Y
echo Copied outputs
REM Sanity check and return home
echo 6 %%G
cd %~dp0
echo Home again
)
goto :EOF
:loop
tasklist /fi "imagename eq MATLAB.exe" |find ":" > nul
REM echo 4 %%G
if errorlevel 1 goto loop
exit /B
I m using psexec to auto run
get.bat
tasklist | findstr pmill.exe >> dc-01\c$\0001.txt
run_get.bat
psexec #%1 -u administrator -p password -c "C:\get.bat"
pclist.txt
on all PCs on our network,
how can i get the result with PC name instead of only pmill.exe in the text file?
is there anyway i can do from powershell?
I need to get the pc name in result.
Hint plz!
Instead of psexec, try this:
#echo off
setlocal enabledelayedexpansion
for /f %%I in (pclist.txt) do (
set /p q="Checking %%I... "<NUL
ping -n 1 -w 500 %%I>NUL 2>NUL
if !errorlevel!==1 (
echo Offline.
) else (
wmic /node:%%I /user:adminuser /password:pass process where name="pmill.exe" get csname 2>NUL | find /i "%%I" >>dc-01\c$\0001.txt
echo Done.
)
)
That'll output %computername% if pmill.exe is running, or nothing otherwise.
Edit:
If you must use psexec then I suggest changing the logic of your for loop that calls psexec, something like this:
#echo off
setlocal enabledelayedexpansion
for /f %%I in (pclist.txt) do (
set pc=%%I
set /p q="Checking %%I... "<NUL
ping -n 1 -w 500 %%I>NUL 2>NUL
if !errorlevel!==1 (
echo Offline.
) else (
for /f %%z in ('psexec \\!pc! -u adminuser -p pass tasklist 2^>^&1 ^| findstr /i "pmill.exe"') do (
set /p q="pmill.exe found. "<NUL
echo !pc!>>dc-01\c$\0001.txt
)
echo Done.
)
)
I need to executes different commands on different status of windows service.
example: (My windows service is OracleServiceXE)
if OracleServiceXE is RUNNING i want to execute command1
if OracleServiceXE is STOPPED i want to execute command2
i wrote below code for this. but it is not working properly. it executes commands in abc portion when OracleServiceXE is RUNNING
sc query "OracleServiceXE" | find /i "RUNNING"
IF ERRORLEVEL 1 then GOTO abc
IF ERRORLEVEL 4 then GOTO bcd
:abc
echo aa
PING 1.1.1.1 -n 1 -w 6000>nul
goto :EOF
:bcd
echo bb
PING 1.1.1.1 -n 1 -w 12000>nul
what is the wrong ?
When searching with find, 0 is the return value when found, 1 is the return value when not found.
You can check that with echo %errorlevel% after the find command.
Also, if ... then is not cmd syntax (perhaps 4nt?).
So, it could be written:
sc query "OracleServiceXE" | find /i "RUNNING"
IF ERRORLEVEL 1 GOTO stopped
IF ERRORLEVEL 0 GOTO running
Note also the order of IF ERRORLEVEL is important as IF ERRORLEVEL n means IF ERRORLEVEL >= n