2010-02-16 20:42:18 +01:00
|
|
|
echo Tests for cmd's builtin commands
|
|
|
|
@echo off
|
2010-02-09 19:11:15 +01:00
|
|
|
|
2010-02-16 20:42:18 +01:00
|
|
|
echo ------------ Testing 'echo' --------------
|
2010-02-09 19:11:15 +01:00
|
|
|
echo word
|
|
|
|
echo 'singlequotedword'
|
|
|
|
echo "doublequotedword"
|
|
|
|
@echo at-echoed-word
|
|
|
|
echo "/?"
|
|
|
|
echo.
|
|
|
|
echo .
|
2010-02-16 21:25:41 +01:00
|
|
|
|
|
|
|
echo ------------ Testing 'set' --------------
|
|
|
|
echo set "FOO=bar" should not include the quotes in the variable value
|
|
|
|
set "FOO=bar"
|
|
|
|
echo %FOO%
|
2010-02-16 21:44:16 +01:00
|
|
|
|
|
|
|
echo ------------ Testing variable expansion --------------
|
|
|
|
echo ~dp0 should be directory containing batch file
|
|
|
|
echo %~dp0
|
|
|
|
mkdir dummydir
|
|
|
|
cd dummydir
|
|
|
|
echo %~dp0
|
|
|
|
cd ..
|
|
|
|
rmdir dummydir
|
2010-03-09 13:15:35 +01:00
|
|
|
echo %%
|
|
|
|
echo P%
|
|
|
|
echo %P
|
|
|
|
echo %UNKNOWN%S
|
|
|
|
echo P%UNKNOWN%
|
|
|
|
echo P%UNKNOWN%S
|
|
|
|
echo %ERRORLEVEL
|
|
|
|
echo %ERRORLEVEL%
|
|
|
|
echo %ERRORLEVEL%%ERRORLEVEL%
|
2010-03-16 10:54:26 +01:00
|
|
|
echo %ERRORLEVEL%ERRORLEVEL%
|
2010-03-09 13:15:35 +01:00
|
|
|
echo %ERRORLEVEL%%
|
|
|
|
echo %ERRORLEVEL%%%
|
|
|
|
echo P%ERRORLEVEL%
|
|
|
|
echo %ERRORLEVEL%S
|
|
|
|
echo P%ERRORLEVEL%S
|
2010-02-18 08:11:04 +01:00
|
|
|
|
|
|
|
echo ------------ Testing if/else --------------
|
|
|
|
echo if/else should work with blocks
|
|
|
|
if 0 == 0 (
|
|
|
|
echo if seems to work
|
|
|
|
) else (
|
|
|
|
echo if seems to be broken
|
|
|
|
)
|
|
|
|
if 1 == 0 (
|
|
|
|
echo else seems to be broken
|
|
|
|
) else (
|
|
|
|
echo else seems to work
|
|
|
|
)
|
2010-02-19 06:39:32 +01:00
|
|
|
echo Testing case sensitivity with and without /i option
|
|
|
|
if bar==BAR echo if does not default to case sensitivity
|
|
|
|
if not bar==BAR echo if seems to default to case sensitivity
|
|
|
|
if /i foo==FOO echo if /i seems to work
|
|
|
|
if /i not foo==FOO echo if /i seems to be broken
|
|
|
|
if /I foo==FOO echo if /I seems to work
|
|
|
|
if /I not foo==FOO echo if /I seems to be broken
|