按顺序运行多个批处理命令

时间:2013-04-04 16:08:41

标签: windows batch-file

当我将此批处理文件命令作为单个批处理文件运行时,第二个命令不会运行。但是当我将它们作为单独的批处理文件命令运行时,它们可以正常工作。

"C:\Program Files\Mozilla Firefox\firefox.exe" -P "america" -no-remote http://hakikahost.com/error.html
"nircmd.exe" win hide process "firefox.exe"

尝试创建一个单个批处理文件,该文件使用call调用两个批处理文件,现在分别将批处理文件命令分开,如下所示

call test.bat
call hide.bat

其中test.bat包含第一个命令而hide.bat包含第二个命令,但它仍然无效。我做错了什么?

2 个答案:

答案 0 :(得分:1)

在关闭窗口之前,firefox.exe可能永远不会返回。尝试使用start启动应用程序,因为start将在应用程序启动后立即返回。

start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -P "america" -no-remote http://hakikahost.com/error.html
start "" "nircmd.exe" win hide process "firefox.exe"

答案 1 :(得分:1)

第一个命令"C:\Program Files\Mozilla Firefox\firefox.exe"在Fx会话结束之前不会返回(即你从它退出)

然后没有Fx可执行文件,因此第二个命令无法隐藏不存在的进程。

尝试

START "" "C:\Program Files\Mozilla Firefox\firefox.exe" -P "america" -no-remote http://hakikahost.com error.html
"nircmd.exe" win hide process "firefox.exe"

唯一的区别是firefox调用之前的START ""。请注意,空引号字符串为required - 如果您愿意,可以在引号之间输入一个字符串 - 这将成为窗口标题。

相关问题