6 rem Basic test of command line. Note a section prefix per command
7 rem to resync, as wine does not output anything in these cases yet.
10 cmd.exe
/c
echo "Line2"
12 cmd.exe
/c
echo Test quotes
"&" work
32 cmd.exe
/c
echo on
>file3
36 cmd.exe
/c
"echo passed1"
38 cmd.exe
/c
" echo passed2 "
40 cmd.exe
/c
"dir /ad ..\fooba* /b"
42 cmd.exe
/cecho No whitespace
48 rem Ensure no interactive prompting when cmd.exe /c or /k
50 cmd.exe
/c
copy file1 file2
>nul
51 echo No prompts or I would
not get here1
52 rem - Try cmd.exe /k as well
53 cmd.exe
/k
"copy file1 file2 >nul && exit"
54 echo No prompts or I would
not get here2
56 rem Nonexistent variable expansion is as per command line, i.e. left as-is
57 cmd.exe
/c
echo %%hello1%%
58 cmd.exe
/c
echo %%hello2
59 cmd.exe
/c
echo %%hello3^
:h=t
%%
60 cmd.exe
/c
echo %%hello4%%%%
62 rem Cannot issue a call from cmd.exe /c
63 cmd.exe
/c
call :hello5
65 rem %1-9 has no meaning
66 cmd.exe
/c
echo one
= %%1
68 rem for loop vars need expanding
69 cmd.exe
/c
for /L
%%i in
(1,1,5) do @
echo %%i
71 rem goto's are ineffective
75 rem - %var% is expanded at read time, not execute time
77 cmd.exe
/c
"set var=22 && setlocal && set var=33 && endlocal && echo var contents: %%var%%"
79 rem - endlocal ineffective on cmd.exe /c lines
80 cmd.exe
/c
"set var=22 && setlocal && set var=33 && endlocal && set var"
83 rem - Environment is inherited ok
84 cmd.exe
/c
ECHO %%VAR%%
92 rem - Temporary batch files
93 echo @
echo 0 > "say.bat"
94 echo @
echo 1 > "say one.bat"
95 echo @
echo 2 > "saytwo.bat"
96 echo @
echo 3 > "say (3).bat"
97 echo @
echo 4 > "say .bat"
99 echo ------ Testing invocation of batch
files ----------
106 if errorlevel 2 echo error %ErrorLevel%
110 if errorlevel 2 echo error
%ErrorLevel%
113 if errorlevel 2 echo error %ErrorLevel%
118 if errorlevel 2 echo error %ErrorLevel%
120 call say" "(3) prints 4?!
121 if errorlevel 2 echo error %ErrorLevel%
123 echo ------ Testing invocation with CMD /C -------------
128 if errorlevel 2 echo error %ErrorLevel%
132 if errorlevel 2 echo error
%ErrorLevel%
136 if errorlevel 2 echo error %ErrorLevel%
139 if errorlevel 2 echo error
%ErrorLevel%
143 if errorlevel 2 echo error
%ErrorLevel%
145 cmd /c
say" "(3) prints
4?
!
146 if errorlevel 2 echo error
%ErrorLevel%
148 echo ---------- Testing
CMD /C quoting
-----------------
152 if errorlevel 2 echo error
%ErrorLevel%
153 cmd /c @
echo "\"\\"\\\"\\\\" "\"\\"\\\"\\\\"
154 rem ---- all 5 conditions met, quotes preserved
159 rem cond 2 - not 2 quotes
163 if errorlevel 2 echo error %ErrorLevel%
164 rem cond 3 - special char - first test fails on Vista, W2K8!
167 rem cond 4 - no spaces (quotes make no difference here)
171 rem cond 5 - string between quotes must be name of executable
173 echo @
echo 5 >"say five.bat"
176 echo ------- Testing
CMD /C qualifier treatment
------------
177 rem no need for space after /c
180 rem ignore quote before qualifier
181 rem FIXME the next command in wine starts a sub-CMD
182 echo THIS FAILS
: cmd "/c"say one
183 rem ignore anything before /c
184 rem FIXME the next command in wine starts a sub-CMD
185 echo THIS FAILS
: cmd ignoreme
/c
say one
187 echo --------- Testing special characters
--------------
188 echo @
echo amp
> "say&.bat"
190 echo @
echo ( > "say(.bat"
192 echo @
echo ) > "say).bat"
194 echo @
echo [ > "say[.bat"
196 echo @
echo ] > "say].bat"
198 echo @
echo { > "say{.bat"
200 echo @
echo } > "say}.bat"
202 echo @
echo = > "say=.bat"
204 echo @
echo sem
> "say;.bat"
206 setlocal DisableDelayedExpansion
207 echo @
echo ! > "say!.bat"
210 setlocal EnableDelayedExpansion
213 echo @
echo %%%% > "say%%.bat"
215 echo @
echo ' > "say'.bat
"
217 echo @echo + > "say+.bat
"
219 echo @echo com > "say,.bat
"
221 echo @echo ` > "say`.bat
"
223 echo @echo ~ > "say~.bat
"
226 echo --------- Testing parameter passing --------------
227 echo @echo 1:%%1,2:%%2 > tell.bat
233 if errorlevel 2 echo error %ErrorLevel%
236 if errorlevel 2 echo error %ErrorLevel%
239 if errorlevel 2 echo error %ErrorLevel%
242 if errorlevel 2 echo error %ErrorLevel%
245 if errorlevel 2 echo error %ErrorLevel%
248 if errorlevel 2 echo error %ErrorLevel%
251 if errorlevel 2 echo error %ErrorLevel%
252 call tell "p
"1 p" "2
255 echo --------- Testing delimiters and parameter passing --------------
256 echo @echo 0:%%0,1:%%1,2:%%2,All:'%%*'> tell.bat
263 echo --------- Finished --------------