0

I want to create a power shell script that can launch my web application on Chrome. Also to launch it in maximized window size.

Below is the related ps1 code:

 $flags = "--app=$appUrl --start-maximized "
 (New-Object -ComObject WScript.shell).Run('chrome.exe ' + $flags)

The result is, the web app launched, but it is not launching in full screen. So the "--start-maximized" switch didn't work for me.

Then I tried the exactly same script on other people's computer, and it works fine with maximized window. Why is this different between computers? We all using windows system.

I have also tried 2 other things on my system:

  1. Change "chrome.exe" to "msedge.exe". It works fine, Edge will launch my app in max size screen.
  2. Change the appURL to "www.google.com", it works fine, Chrome will launch google.com in max size screen.

Is there any chrome setting to accept the flags? I have been searching online for a while, but I can't find anything related to this.


A bonus question: When it is working. The --start-maximized will be used and launch my app in maximized screen, but it will also makes the child windows that opened by my app in maximized screen. Is there another flag that only works for the main window, not for the child window?

4
  • What happens when you try --start-fullscreen , same behaviour or does that work? Commented Mar 14 at 21:29
  • As an aside: you can simplify your invocation to: Start-Process chrome.exe "--app=$appUrl --start-maximized"
    – mklement0
    Commented Mar 14 at 22:09
  • @TerrellPlotzki It works the same as --start-maximized, it will be full screen on others, not for me
    – Tian Qin
    Commented Mar 15 at 13:06
  • @mklement0 I have tried that, it works the same
    – Tian Qin
    Commented Mar 15 at 13:24

0