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:
- Change "chrome.exe" to "msedge.exe". It works fine, Edge will launch my app in max size screen.
- 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?
Start-Process chrome.exe "--app=$appUrl --start-maximized"