看来cmd脚本包含:
prog1
prog2
Run Code Online (Sandbox Code Playgroud)
做同样的事
call prog1
call prog2
Run Code Online (Sandbox Code Playgroud)
使用CALL命令有什么意义?
pax*_*blo 21
call当你想要时,你应该使用:
带有以下行的命令文件:
number2.cmd
Run Code Online (Sandbox Code Playgroud)
将链接到number2.cmd文件,这意味着它将运行该脚本但不返回继续执行当前的脚本.
至于第二点,你可以做以下事情:
call :subroutine
call :subroutine
goto :eof
:subroutine
echo in here
goto :eof
Run Code Online (Sandbox Code Playgroud)
你将被in here打印两次.这种在命令脚本中调用函数的能力实际上非常方便.
mpo*_*llo 14
您应该call在需要调用另一个批处理程序(cmd脚本)时使用.如果prog1是可执行文件,使用'call'将不起作用.(prog1.exe)
例如,如果您有两个脚本:
cmd1.cmd
cmd2.cmd
Run Code Online (Sandbox Code Playgroud)
并在cmd1.cmd你有一句台词:
cmd2.cmd
Run Code Online (Sandbox Code Playgroud)
...然后你的脚本会cmd2.cmd在完成执行后立即停止.相反,你应该使用:
call cmd2.cmd
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27098 次 |
| 最近记录: |