forked from FDOS/freecom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtst-if.bat
74 lines (69 loc) · 1.98 KB
/
tst-if.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
@echo off
: IF test script
cls
ECHO.
ECHO TEST SCRIPT FOR THE IF COMMAND
ECHO.
ECHO Testing the EXIST format
ECHO.
ECHO It is assumed that the file TST-IF.BAT does exist, but
ECHO NICHT-DA.TGL does not exist
ECHO.
if exist tst-if.bat echo File TST-IF.BAT exists ((OK))
if not exist tst-if.bat echo File TST-IF.BAT does not exist ((ERROR!!??))
if exist nicht-da.tgl echo File NICHT-DA.TGL exists ((ERROR!!??))
if not exist nicht-da.tgl echo File NICHT-DA.TGL does not exist ((OK))
echo.
echo You should see "((OK))" two times
echo.
echo If you see an ERROR, check if the specified file is really
echo not there (TST-IF.BAT) or really is there (NICHT-DA.TGL)
echo.
pause
cls
ECHO Testing the ERRORLEVEL format
ECHO.
if exist errlvl.exe goto err_OK
if exist errlvl.com goto err_OK
echo Cannot find an executable of the ERRLVL program, please
echo compile it, in order to run this test
goto err_SKIP
:err_OK
errlvl 0
::echo Errorlevel %? (must be '0')
echo Errorlevel %errorlevel% (must be '0')
if not errorlevel 1 echo Probe #1 passed
if errorlevel 1 echo Probe #2 failed
errlvl 15
::echo Errorlevel %? (must be '15')
echo Errorlevel %ERRORLEVEL% (must be '15')
if errorlevel 15 echo Probe #3 passed
if errorlevel 16 echo Probe #4 failed
if errorlevel 14 echo Probe #5 passed
echo.
echo You should see passed probes 1, 3,& 5 and no failed one.
echo Also make sure that the displayed errorlevels match the one
echo mentioned as "must be 'XX'"
echo.
pause
cls
ECHO Testing the == format
ECHO.
if 1==1 echo Probe #1 passed
if 2==1 echo Probe #2 failed
if not 1==2 echo Probe #3 passed
if not 1==1 echo Probe #4 failed
if 1 == 1 echo Probe #5 passed
if 1 == 2 echo Probe #6 failed
if 1 ==1 echo Probe #7 passed
if 1 ==2 echo Probe #8 failed
if 1== 1 echo Probe #9 passed
if 1== 2 echo Probe #10 failed
if not 1=="1" echo Probe #11 passed
if not "1 2 3 4"=="1 2 3 4" echo Probe #12 failed
echo.
echo You should see passed probes 1, 3, 5, 7, 9,& 11 and no failed one
echo.
pause
echo.
echo Test finished