2017-02-13 118 views
0

我很努力地使用.bat腳本或僅從cmd行殺死Internet Explorer子進程(關閉一個IE選項卡)。 我已經嘗試過:Taskkill Internet Explorer子進程

taskkill /pid {pidid} /f /t

taskkill /pid {pidid} /t

,它是不工作的。我得到{pidid}被終止的輸出,但另一個PID被設置並且選項卡未關閉。

回答

1

這是IE崩潰檢測踢,如果你只是殺了一個選項卡進程,它會嘗試恢復選項卡,因爲它認爲頁面上的東西導致它崩潰。

如果您想以文檔化和清晰的方式與Internet Explorer進行交互,則需要切換到另一種語言,以便您可以執行UI Automation或使用Shell.Windows可編寫腳本的對象。

+0

我很困惑,所以我需要claryfie。我可以使用powershell/batch/vns或其他默認的Windows工具包嗎? – lukesky

+0

您可以在VBScript或JScript中使用Windows腳本宿主和代碼(https://blogs.msdn.microsoft.com/oldnewthing/20050705-08/?p=35043)或PowerShell(http://stackoverflow.com/questions/ 36986506/select-ie-window-using-hwnd) – Anders

+0

'Stop-Process 14000' does not work and'get-process iexplor | Stop-Process'工作,因爲它殺死了每個IE進程。 Sostill我找不出好的解決方案。 – lukesky