Bob the Builder
Bob the Builder

Reputation: 543

Close a chrome browser window opened by batch file

I have a simple batch script on the server that opens an instance of chrome and a url address using some javascript as well.

The above is working fine but I am then trying to close the browser after 30 seconds.

I have installed PSKill but my batch code is not working.

Do I have to specify the full path or something to the pskill.exe file?

Thanks for all relevant replies.

@echo off
start chrome.exe javascript:document. http://google.com
TIMEOUT 30
PSKILL chrome.exe

Upvotes: 0

Views: 6210

Answers (1)

studio1057
studio1057

Reputation: 157

taskkill /F /IM chrome.exe /T > nul

"> nul" needs to suppress error messages, preventing getting roped into a dialog

Upvotes: 1

Related Questions