Write a Batch Script to Open Chrome
Whether you want to automate your routine tasks, doing some experiment or just setting up some pranks, Google Chrome supports command line and let you create a batch script file to control it. In this post, we’ll show you how to do that!
Opening Chrome
Use the following command to open Chrome. If there is an existing Chrome window, it will just open new tab instead.
start chrome "www.google.com"
To force open a new window, add the –new-window option
start chrome --new-window "www.google.com"
To just open a new blank/empty tab
start chrome "about:blank"
To open incognito mode, just add –incognito
start chrome --new-window --incognito "www.google.com"
You can create a batch script file or run it directly like this.
Closing Chrome
Use taskkill command to forcefully (/F option) terminate Chrome (/IM option) and all child processes started by it (/T option). You must have and run the batch script as an Administrator to be able to terminate the process.
taskkill /F /IM chrome.exe /T
Other Useful Options
These are useful execution flags that you might have a chance to use them. For full list of Chromium commands, please refer to peter.sh
–start-maximized | Start Chrome with maximized window |
–window-position | Specify window position with –window-position=x,y |
–restore-last-session | Restore last browsing session |
–disable-plugins | Disable all Chrome plugin (extension) |
–no-startup-window | Launch Chrome as background without window |
–screenshot | Save screenshot of the loaded page |
Can be used like below:
start https://www.youtube.com/