summaryrefslogtreecommitdiff
path: root/win32/test_shellsplit.cmd
blob: 8a2e8ec8f45961acac50e949b2847b1b2c079a38 (plain)
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
@echo off & if not [%1]==[] goto :process

echo.
echo This script demonstrates how shellsplit.cmd works.
echo usage: %0 arg1 arg2...
echo.
echo Prints separated arguments as (arg1)(arg2)...
echo - splits commandline with spaces/tabs. cmd.exe standard rule is ignored.
echo - you can use double quotes to contain spaces/tabs into an argument.
echo - you can not escape double quote.
echo - solitary "" is ignored since cmd.exe variables cannot represent empty value.
exit /b 0

:process
setlocal
set V=0

:: %* can contain meta character inside quote. do not use set "args=%*" here.
set args=%*

:loop
call %~dp0\shellsplit.cmd
if not defined argv goto :end
set /p "tmp=(%argv%)"<NUL
goto :loop

:end
endlocal & exit /b 0