我想将一些文件复制到不同的USB磁盘中,并希望使用START打开几个控制台,如下所示:
start copy a.txt h:
start copy a.txt i:
start copy a.txt j:
Run Code Online (Sandbox Code Playgroud)
但每次运行批处理文件时,都有3个控制台没有退出.如何在不使用3个批处理文件和"调用"命令的情况下实现此EXIT功能:
copy.bat:
call a.bat
call b.bat
call c.bat
exit
Run Code Online (Sandbox Code Playgroud)
和三个称为批处理文件:
一只蝙蝠:
start copy a.txt h:
exit
Run Code Online (Sandbox Code Playgroud)
b.bat:
start copy a.txt i:
exit
Run Code Online (Sandbox Code Playgroud)
C.BAT:
start copy a.txt j:
exit
Run Code Online (Sandbox Code Playgroud)
我已经尝试过这个,但它不起作用:
start copy a.txt h: && exit
start copy a.txt i: && exit
start copy a.txt j: && exit
Run Code Online (Sandbox Code Playgroud)
And*_*ers 15
你需要转义&&所以它成为start启动而不是父批处理文件执行的命令的一部分.
start copy a.txt h: ^&^& exit
Run Code Online (Sandbox Code Playgroud)
要关闭新控制台,即使出现错误,您也可以执行以下操作:
start "" "%comspec%" /c copy a.txt h:
Run Code Online (Sandbox Code Playgroud)
您可以使用start启动一个新的 cmd 窗口并在运行命令后将其关闭,如下所示:
start cmd /c copy a.txt h:
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13457 次 |
| 最近记录: |