19

I want to change the Display Arrangement of my computer via Command line. I have 2 monitors set up, extending, and I want to change the monitors setup from Dual Display to Single Display and back via command line.

I've had a look through QRes and nircmd. While QRes lacks multimonitor support entirely, nircmd cannot disable a monitor, only change the primary state and the resolution of separate screens.

It would be appreciated if you know of a way to do that.

Edit: I will post my solution here using the display changer in climenoles answer:

@echo off
REM setting to single screen
echo *** Disabling Screen 2 *** 
cd C:\Program Files (x86)\12noon Display Changer\
dc64cmd.exe -monitor="\\.\DISPLAY2" -detach

echo Starting TF2 -fullscreen -novid -console -w 1920 -h 1200
REM Starting Team Fortress 2 fullscreen
cd C:\Program Files (x86)\Steam
Steam.exe -applaunch 440 -fullscreen -novid -console -w 1920 -h 1200

REM pausing because steam.exe returns before TF2 quits
echo Press a key to reenable Screen 2
pause
cd C:\Program Files (x86)\12noon Display Changer\
dc64cmd.exe -monitor="\\.\DISPLAY2" -secondary
2
  • Your post actually gave me the idea for this feature I added to TvGameLauncher. Check it out if still relevant (See my answer below). Jul 12, 2014 at 17:58
  • @Durga Please consider this answer to detect the presence of another monitor with Windows Powershell. For using more than 2-3 Displays, you can consider my question here. Another related Q/A can be found here
    – Cadoiz
    Jan 10, 2022 at 16:10

9 Answers 9

9

This utility may help you: Display Changer :

«Display Changer changes the display resolution, runs a program, then restores the original settings. It can also change the resolution permanently and rearrange the monitors in a multiple-monitor setup»

Works in GUI or command line and it's free for personnal use...

http://12noon.com/?page_id=80

Hope this help. Let us know.

4
  • Upvote for a good answer, but it will not work that way. I am trying to launch a Steam game that way. Launching it via the "steam://rungameid/#" does not work as it gives you no executable. running steam.exe with the -applaunch # option changes the resolution, does not start the game and immediately changes back (so fast you hardly see it). running the game executable directly leads to a loading error. Nice idea, yet it didn't work. Feb 28, 2012 at 17:42
  • But I just realized I can create a batch file with the initial command to change to one screen, start the game in a separate command line and then change back after the program terminates, all within a batch, that should theoretically work. I'll have to try that. Feb 28, 2012 at 17:44
  • Okay. Tell us if this works for you. If the batch works well you may compile it to have an .exe file With this for example: batchcompiler.sourceforge.net :)
    – climenole
    Feb 28, 2012 at 18:14
  • Thank you. That works perfectly fine, except for the fact that steam.exe returns immediately, so I have to use "pause" or the batch won't work. Feb 29, 2012 at 20:42
19

Big thanks to Bill Rodman's comment in this thread.

I combine this utility with the Windows7 DisplaySwitch.exe command: "C:\Windows\System32\DisplaySwitch.exe /internal" to switch exclusevely to the main monitor. – Bill Rodman Jan 29 '10 at 12:17

Testing this out, this calls and immediately selects the screen to choose via the.

  • /internal calls the internal screen (your primary display)
  • /external changes to the external screen (im not sure how well it handles when there is more than 1 screen)
  • /clone duplicates displays.
  • /extend switches to extended settings.

Since this is calling a file path, simply attach this to your batch script and baboom, instant and effective display changing. A good idea would be to string this togethor into windows Task Scheduler UI as you can call the file path, and give it the arguments, then whenever your TF2 event happens, the display will always switch.

6
  • Works without administrator rights, works at 1 click distance.
    – m3nda
    Sep 16, 2019 at 23:00
  • Calling it without arguments shows the sidebar with the four options. Feb 18, 2020 at 11:18
  • For some reason, it only worked for me (I'm using a batch file) when I called the command without the entire path. I created a file called "1.bat" with one line: "displayswitch /internal" and another file called "2.bat" with the line "displayswitch /extend". Works like a charm! Thanks! May 19, 2020 at 14:09
  • 1
    don't work with windows 11 Dec 7, 2022 at 12:56
  • 1
    I can confirm that the last Windows 11 Insider update (Beta channel) broke the /internal /external switch functionality for me. I tried the DisplaySwitch.exe from a backup from July and that worked again.
    – Vindolin
    Jan 2 at 9:15
12

You were close with NirCmd, but what you're looking for is Nir's MultiMonitorTool:

MultiMonitorTool is a small tool that allows you to do some actions related to working with multiple monitors. With MultiMonitorTool, you can disable/enable monitors, set the primary monitor, save and load the configuration of all monitors, and move windows from one monitor to another. You can do these actions from the user interface or from command-line, without displaying user interface. MultiMonitorTool also provides a preview window, which allows you to watch a preview of every monitor on your system.

The 12noon tool looks nice, but barring an official MS tool, I'll take NirSoft over any other tool any day.

Shameless plug: You may be interested in the TvGameLauncher tool I wrote for exactly this purpose (switching primary displays for playing games). It can also switch to HDMI audio and prevent the screensaver from popping up while you're playing (without disabling it). It even supports the Steam protocol (Steam://) so you don't have to use the pause trick. It doesn't support disabling your other monitors though, but I'll add that to my todo list (I have some other cool features coming up like automatic TV shortcut generation).

Edit - all features added. Check it out!

2
  • 1
    NirSoft rocks. I've just had to find a solution to switch my monitors. I have a two-monitor setup, when one of them on and other is off. So no any fancy extended desktop mode etc. With MultiMonitorTool, now I have just a single one-liner: MultiMonitorTool.exe /switch 1 /switch 2 which switches off currently running monitor and at the same time turns off other. I put this command to my keyboard's macros key and now monitors are getting switched via a single keystroke! Feb 12, 2017 at 14:27
  • MultiMonitorTool worked poorly for me with different configurations of 3 monitors: some disabled, cloned, etc. It applied some configurations with a resolution of 0x0, which caused Nvidia Control Panel to not be able to open.
    – NateS
    Nov 8, 2017 at 1:52
3

While I realize this is an old thread, toggling between display modes in Windows 10 using tools available by default is possible. The problem I ran into was there was no "clear" mechanism to tell that the display was Extended, vs. Cloned. Here is my working prototype in PowerShell:

#ext_or_clone.ps1
#Toggle between Extend and Clone displays
#requires PowerShell 3

#Load Windows Forms .Net class
#if PowerShell < 3 use this instead: [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
Add-Type -AssemblyName System.Windows.Forms

#check the width of the virtual display, the "mode" width 
$currDispMode = [System.Windows.Forms.SystemInformation]::VirtualScreen.Width

#check the width of the primary display
$oneScrWidth = [System.Windows.Forms.SystemInformation]::WorkingArea.width


#compare the two widths
switch ($currDispMode)
{
    #if the widths are the same,
    # it means the displays are in clone mode, so the mode should be extend
    $oneScrWidth{displayswitch.exe /extend}

    #if the VirtualScreen width is greater than the primary screen width
    # it means displays are in extend mode, so the mode should be clone
    {$_ -gt $oneScrWidth}{displayswitch.exe /clone}
}
1
2

WizardSoft's WS Display Settings is a neat little tool and pretty simple to use for command line newbies:

Command line tool to save and restore Windows display settings to and from file. Easy multi-monitor setup. Create presets for laptop, tv, monitor and beamer. It can save and restore the exact binary representation of the current Windows display settings.

What I wanted was a shortcut to switch to extended and another to go back to single display. After 30 minutes of mucking around with it - success!

I used Windows 7 and after reading readme.txt you could easily set this up too.

The simplest way to use the tool is to save the current display settings to a file with

WsDisplaySettings.exe -save filename.dis

and load & apply the settings with

WsDisplaySettings.exe filename.dis

There are also more advanced features, as explained in the readme file.

If I ran a business I would pay for the program! (It's free for personal use.)

2
2

You can use DisplaySwitch.exe /internal to change the display settings to use only your primary monitor, and DisplaySwitch.exe /extend to switch back to your multi-monitor setup. More info here. Works on Windows 10, too.

1

Another good one is wsdisplaysettings. Command line tool to setup displays to your liking. Can also create settings files for convenience.

2
0

I have a laptop and an external monitor, so I call displayswitch.exe /external to only use the extended monitor and displayswitch.exe /extend to use both.

Also, to use both monitors for one user and turn off the internal monitor when the screen gets locked, I added windows tasks that gets triggered on workstation lock and unlock:

enter image description here

The one on lock has "Run with highest privilege" flag turned on.

-1

wow exactly what I was looking for my 3x1 setup on Win10. A straight-forward tray icon with 3 actions:

  • all Monitors ON full span display
  • only my middle monitor ON (left and right OFF)
  • only my right Monitor ON (left and middle OFF)

Kudos Andrew :-)

2
  • Welcome to superuser; This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment or vote up on any post, this would be a vote up to thank, again welcome to superuser and keep coming back.
    – mic84
    Feb 5, 2021 at 1:38
  • Please don't add "thanks" as answers. Invest some time in the site and you will gain sufficient privileges to upvote answers you like, which is the Super User way of saying thank you.
    – DavidPostill
    Apr 15, 2021 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.