DisplaySwitch.exe behavior on Windows 11 22H2

Akshay Singh 56 Reputation points
2022-10-05T12:09:55.627+00:00

I have two displays connected to my PC, running Windows 11 Home. I use just the primary display most of the time but need to switch on my secondary display whenever I'm running a VM or need more screen estate.

For years, I've used DisplaySwitch.exe in conjunction with AutoHotKey to quickly switch between different display configurations. Here's the relevant snippet of my configuration:

^!1::  
; Ctrl+Alt+1 = Display 1  
Run, %A_WinDir%\System32\DisplaySwitch.exe /internal  
return  
  
^!2::  
; Ctrl+Alt+2 = Display 2  
Run, %A_WinDir%\System32\DisplaySwitch.exe /external  
return  
  
^!3::  
; Ctrl+Alt+3 = Display 1+2  
Run, %A_WinDir%\System32\DisplaySwitch.exe /extend  
return  

Today, I installed the 22H2 (build 22621.521) update and suddenly, those shortcuts stopped working. Now, pressing any of those key combinations pops up the Project window:

247759-image.png

Apparently, DisplaySwitch.exe no longer accepts the /internal, /external and /extend switches.

Is there an alternative method to get this working again?

Thanks for your time.

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,410 questions
0 comments No comments
{count} votes

13 answers

Sort by: Most helpful
  1. OldGoose-7373 25 Reputation points
    2023-04-17T23:24:20.9066667+00:00

    For Windows 11 use this command (there should not be a space after the number):

    DisplaySwitch 4
    

    Numbers:

    1 = /internal
    2 = /clone  
    3 =  /extend
    4 =  /external
    

    For Windows 10 use this command:

    DisplaySwitch.exe /external
    
    5 people found this answer helpful.

  2. Akshay Singh 56 Reputation points
    2022-10-06T08:04:55.33+00:00

    In case someone arrives here looking for a solution to a similar problem, I managed to solve it by copying DisplaySwitch.exe from a Windows 10 installation to a different location, and using that instead of the inbuilt DisplaySwitch.exe.

    My modified AHK config is:

    ^!1::  
    ; Ctrl+Alt+1 = Display 1  
    Run, "D:\Software\Display Switch\DisplaySwitch.exe" /internal  
    return  
      
    ^!2::  
    ; Ctrl+Alt+2 = Display 2  
    Run, "D:\Software\Display Switch\DisplaySwitch.exe" /external  
    return  
      
    ^!3::  
    ; Ctrl+Alt+3 = Display 1+2  
    Run, "D:\Software\Display Switch\DisplaySwitch.exe" /extend  
    return  
    
    4 people found this answer helpful.

  3. mkdr 96 Reputation points
    2022-12-04T06:59:24.327+00:00

    How incompetent can someone be... I have the same problem with Windows 11. Can anyone provide the displayswitchexe from Windows 10 please through a dropbox share or some other way, with a sha256 hash multiple people can confirm is the correct one. thanks

    here is a version someone shared from windows 10, it has digital signatur by windows, so that is safe:

    https://www.reddit.com/r/windowsinsiders/comments/uurnqd/comment/ipeoq15/?utm_source=reddit&utm_medium=web2x&context=3

    also theory in reddit post is, the cause of this problem is, they changed the exe to UWP app, and obviously that is missing arguments, same as switching to notepad.exe to UWP app which is totally 1000 times slower and buggy as hell.

    MS is a joke.

    3 people found this answer helpful.

  4. Shulamit Tanger 10 Reputation points
    2023-06-25T08:08:39.8466667+00:00

    Finally, I created a Windows Forms app using the .NET Framework. I replaced the code in the Program.cs file and built the executable (exe) file by running the build command. To execute the extend/duplicate functionality, simply run 'switchDisplay.exe with extend' or 'switchDisplay.exe with duplicate'.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.InteropServices;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace switchDisplay
    {
        internal static class Program
        {
    
            [Flags]
            public enum SetDisplayConfigFlags : uint
            {
                SDC_TOPOLOGY_INTERNAL = 0x00000001,
                SDC_TOPOLOGY_CLONE = 0x00000002,
                SDC_TOPOLOGY_EXTEND = 0x00000004,
                SDC_TOPOLOGY_EXTERNAL = 0x00000008,
                SDC_APPLY = 0x00000080
            }
    
            [DllImport("user32.dll", CharSet = CharSet.Unicode)]
            private static extern long SetDisplayConfig(uint numPathArrayElements,
                IntPtr pathArray, uint numModeArrayElements, IntPtr modeArray, SetDisplayConfigFlags flags);
    
            static void CloneDisplays()
            {
                SetDisplayConfig(0, IntPtr.Zero, 0, IntPtr.Zero, SetDisplayConfigFlags.SDC_TOPOLOGY_CLONE | SetDisplayConfigFlags.SDC_APPLY);
            }
    
            static void ExtendDisplays()
            {
                SetDisplayConfig(0, IntPtr.Zero, 0, IntPtr.Zero, SetDisplayConfigFlags.SDC_TOPOLOGY_EXTEND | SetDisplayConfigFlags.SDC_APPLY);
            }
    
            static void ExternalDisplay()
            {
                SetDisplayConfig(0, IntPtr.Zero, 0, IntPtr.Zero, SetDisplayConfigFlags.SDC_TOPOLOGY_EXTERNAL | SetDisplayConfigFlags.SDC_APPLY);
            }
    
            static void InternalDisplay()
            {
                SetDisplayConfig(0, IntPtr.Zero, 0, IntPtr.Zero, SetDisplayConfigFlags.SDC_TOPOLOGY_INTERNAL | SetDisplayConfigFlags.SDC_APPLY);
            }
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main(string[] args)
            {
                if (args.Length > 0)
                {
                    string parameter = args[0].ToLower();
    
                    if (parameter == "extend")
                    {
                        ExtendDisplays(); // Set the display mode to extend
                    }
                    else if (parameter == "duplicate")
                    {
                        CloneDisplays(); // Set the display mode to duplicate
                    }
                    else
                    {
                        MessageBox.Show("Invalid parameter. Please provide either 'extend' or 'duplicate'.");
                    }
                }
                else
                {
                    MessageBox.Show("No parameter provided. Please provide either 'extend' or 'duplicate'.");
                }
            }
        }
    }
    
    
    2 people found this answer helpful.
    0 comments No comments

  5. Limitless Technology 39,426 Reputation points
    2022-10-06T15:03:26.59+00:00

    Hello there,

    In most cases, DisplaySwitch.exe file problems are due to the file missing or being corrupted (malware / virus). See if you can repair it by running a system file fix then an image repair. Here's how:

    Run System File Checker

    1. Press Windows key + S, this will open search
    2. Type cmd, run command prompt as administrator
    3. Enter this command and press enter: sfc /scannow
    4. Wait for the process to finish and reboot your computer.
    5. Check if the issue still persists.

    Run windows image fix.

    1. Press Windows key + S, this will open search
    2. Type cmd, run command prompt as administrator
    3. Enter this command and press enter: DISM /Online /Cleanup-Image /RestoreHealth
    4. Wait for the process to finish and reboot your computer.
    5. Check if the issue still persists.

    --------------------------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer--