How can I swap my primary monitor in a batch file?
Solution 1
Maybe you can try nircmd.exe which is a small but powerful command-line utility .
http://www.nirsoft.net/utils/nircmd.html
setdisplay {monitor:index/name} [width] [height] [color bits] {refresh rate} {-updatereg} {-allusers}
....... You can specify the monitor by index (0 for the first monitor, 1 for the second one, and so on) or by specifying a string in the system monitor name...........
Solution 2
Another solution is to use the multi monitor tool, as it allows for more functionality towards switching monitors, such as moving windows as well. Also has a simpler command for the basic task at hand.
http://www.nirsoft.net/utils/multi_monitor_tool.html
/SetPrimary <Monitor>
Set the primary monitor.
Example:
MultiMonitorTool.exe /SetPrimary 2
Maxime Tremblay-Savard
Updated on June 24, 2022Comments
-
Maxime Tremblay-Savard almost 2 years
Everything is pretty much in the title, I have tested using Display Changer but without success because my monitor are both named "Generic PnP Monitor" so I can't say which screen must be set as the primary. I've seen that i need to download the drivers to get my monitor a name but both of my monitor don't have driver for Windows 10. I would think there must be a way to simply swap the principal screen to the other one or something like that but I haven't seen anyone do it.
-
Maxime Tremblay-Savard over 8 yearsI've used your tool. The correct command to do what i wanted was: nircmd setprimarydisplay 2