Board logo

标题: FOR 命令疑问 [打印本页]

作者: kfireway     时间: 2008-8-15 11:43    标题: FOR 命令疑问
有一个程序调用时是这样调用的

test.exe "1-test"
test.exe "2-test"
test.exe "3-test"

我现在想写成一个批处理

text.bat "1-test|2-test|3-test"

如何用 FOR 命令把 "1-test|2-test|3-test" 分开后调用 test.exe 呢?

作者: NaturalJ0     时间: 2008-8-15 14:31
直接用多个参数分别传,处理参数就行了.

%0 %1 %2 ... %9
shift

作者: kfireway     时间: 2008-8-15 14:50
是想把 "1-test|2-test|3-test"

然后有时传 "1-test|2-test"
有时传"3-test"

我要这样的。

作者: ThinKing     时间: 2008-8-15 17:47
你分开传不就是可以了?

作者: HAT     时间: 2008-8-16 22:55
直接用空格作为参数分隔符多好啊,干吗非要用管道符号?

@echo off
:begin
start test.exe %1
shift
if "%1" equ "" goto :eof
goto :begin