首页 > 解决方案 > 将多个命令传递给从批处理文件启动的批处理文件

问题描述

    set consoleName="hello"
    set batch=echo foo
    start "%consoleName%" /max %batch% cmd.exe

这确实有效,输出: foo. 但是,执行任何超过一个命令的操作都不起作用:

    set consoleName="hello"
    set batch=(
echo %itchy%
if %itchy% lss 50 (echo foo)
else
(echo bar)
)
echo hi
    start "%consoleName%" /max %batch% cmd.exe

输出: System cannot open file (. 到目前为止,所有这些都不起作用:

   set consoleName="hello"
    set batch=echo foo , echo bar
    set batch2= echo foo ^& echo bar
    start "%consoleName%" /max %batch% cmd.exe
    start "ex2" %batch%%batch% cmd.exe
    start "ex3" %batch2% cmd.exe

输出结果为: hello: foo cmd.exe ex2 : fooecho foo cmd.exe(在命令提示符内:)

barecho foo
bar cmd.exe

例 3:foo cmd.exe

我不能使用clonecall,我必须使用start

标签: batch-filecmd

解决方案


推荐阅读