0

I'm struggling to kill internet explorer child process (to close one IE tab) using .bat script or just from cmd line. I've already tried:

taskkill /pid {pidid} /f /t

or

taskkill /pid {pidid} /t

and it is not working at all. I got the output that {pidid} was terminated but another pid is set up and the tab is not closed.

Cœur
  • 37,241
  • 25
  • 195
  • 267
lukesky
  • 29
  • 1
  • 9

1 Answers1

1

This is the IE crash detection kicking in, if you just kill one of the tab processes it will try to restore the tab because it thinks something on the page caused it to crash.

You need to switch to another language so you can do UI Automation or use the Shell.Windows scriptable object if you want to interact with Internet Explorer in a documented and clean fashion.

Community
  • 1
  • 1
Anders
  • 97,548
  • 12
  • 110
  • 164
  • I'm confused so I need to claryfie. Can I do it with powershell/batch/vns or other default windows toolkits? – lukesky Feb 14 '17 at 00:16
  • You can use Windows Scripting Host and code in VBScript or JScript ( https://blogs.msdn.microsoft.com/oldnewthing/20050705-08/?p=35043 ) or PowerShell ( http://stackoverflow.com/questions/36986506/select-ie-window-using-hwnd ) – Anders Feb 14 '17 at 00:35
  • `Stop-Process 14000` didn't work and `get-process iexplor | Stop-Process` worked because it killed every IE process. Sostill I can't figure out good solution. – lukesky Feb 14 '17 at 07:58