- @echo off&setlocal enabledelayedexpansion
- set line1="run file.txt -t 6 -n 9 c:\test\1.dat"
- set line2="run file.txt -n 2 -q 5 c:test\1.dat"
- set line3="run file.txt -b 4 c:\test\1.dat"
-
- for %%a in (%line1% %line2% %line3%) do (
- echo;%%a|find "-n" >nul &&call :aa "%%~a"||(echo;命令%%~a中,var=1)
- )
- pause&exit
- :aa
- set str=%~1
- set str=%str:-n=#%
- for /f "tokens=2 delims=#" %%a in ("%str%") do (
- for %%b in (%%a) do (
- echo;命令%~1中,var=%%b
- goto :eof
- )
- )
复制代码
|