2013-04-04 42 views
0

當我將這個批處理文件命令作爲單個批處理文件運行時,第二個命令不會運行。但是,當我將它們作爲單獨的批處理文件命令運行時,它們工作正常。在序列中運行幾個批處理命令

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

嘗試創建其中具有call的兩個批處理文件現在已經分離出的批處理文件稱爲1個單批次文件命令分開這樣

call test.bat 
call hide.bat 

其中test.bat包含在所述第一指令和hide.bat包含在第二指揮,但它仍然沒有工作。我做錯了什麼?

回答

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" 
+0

作品!謝謝(你的)信息! – 2013-04-04 17:48:21

1

的第一個命令,"C:\Program Files\Mozilla Firefox\firefox.exe"不會返回,直到Fx的會議已經結束(即你從它EXIT)

則沒有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" 

唯一不同的是火狐,調用之前的START ""。請注意,空引號字符串是required - 如果您願意,您可以在引號之間輸入一個字符串 - 這將成爲窗口標題。

+0

作品!謝謝(你的)信息! – 2013-04-04 17:47:26