Launching 2 Google Chrome windows in different positions

15,731

Solution 1

The window args don't seem to be working at all in my environment, but following other examples that use javascript to move the window do. Here's an example (switched "Program Files" for 64bit):

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app="data:text/html,<html><body><script>window.moveTo(200,200);window.resizeTo(400,300);window.location='http://www.example.com';</script></body></html>"

and the 2nd:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app="data:text/html,<html><body><script>window.moveTo(600,200);window.resizeTo(400,300);window.location='http://www.example.com';</script></body></html>"

The windowing works, but the taskbar icons are set to generic files instead of chrome.

Solution 2

You need to create a session (--user-data-dir) for each window, try this:

start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window "http://brianp.dk/" --window-size="2560,1000" --window-position="0,0" --user-data-dir="D:/Test/Profiles/1"
start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window "http://borsen.dk/" --start-maximized --window-position="2560,000" --user-data-dir="D:/Test/Profiles/2"
start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window "http://penge.dk/" --window-size="1280,1000" --window-position="0000,1000" --user-data-dir="D:/Test/Profiles/3"
Share:
15,731

Related videos on Youtube

kieran
Author by

kieran

Updated on September 18, 2022

Comments

  • kieran
    kieran over 1 year

    I am trying to create shortcuts (to eventually add to startup folder) on Windows 7 that will launch Google Chrome as two differently sized window at two different positions, in app mode.

    I have two shortcuts:

    "C:\Program Files\Google\Chrome\Application\chrome.exe" --app=http://www.example.com --window-size=400,300 --window-position=200,200
    

    and:

    "C:\Program Files\Google\Chrome\Application\chrome.exe" --app=http://www.example.com --window-size=400,300 --window-position=600,200
    

    That should launch the first window 400px x 300px, 200px from the left and 200px from the top.

    The second window shout launch 400px x 300px, 600px from the left and 200px from the top.

    Whichever window I launch first works correctly. If I launch the first shortcut first it launches 200px from the left, if I launch the second first it launches 600px from the top.

    However, whichever I launch second launches in the same position as the first.

    How can I make these work independently from eachother so whichever I launch does not snap to the position of the first window launched?

  • Tim Hall
    Tim Hall almost 4 years
    thanks for that, you're a life saver. I think its utterly stupid how that is a requirement, i have to do the --user-data-dir anyway just to enable debugging, just so i can tell when the browser is closed (or close it myself) so it's no extra hassle, I just didn't use it when constructing the test command line