Is it possible to change display scaling via command line?












3















I've got a laptop with a 2560 x 1440 display, connected to 2 external 1080p monitors. The scaling is fine normally, with the native monitor at 125% and the 1080p monitors at 100%, but when I undock the laptop, sometimes the laptop goes to 200% scaling factor and I need to reset it manually in display settings.



I would like to find a command that emulates the setting here, such that I don't need to right click on the desktop and open display settings every time I unplug my external monitors:



enter image description here



The only registry keys/PowerShell commands I've found for this require logging out to take effect, which doesn't seem necessary given the GUI setting can take effect immediately.










share|improve this question





























    3















    I've got a laptop with a 2560 x 1440 display, connected to 2 external 1080p monitors. The scaling is fine normally, with the native monitor at 125% and the 1080p monitors at 100%, but when I undock the laptop, sometimes the laptop goes to 200% scaling factor and I need to reset it manually in display settings.



    I would like to find a command that emulates the setting here, such that I don't need to right click on the desktop and open display settings every time I unplug my external monitors:



    enter image description here



    The only registry keys/PowerShell commands I've found for this require logging out to take effect, which doesn't seem necessary given the GUI setting can take effect immediately.










    share|improve this question



























      3












      3








      3








      I've got a laptop with a 2560 x 1440 display, connected to 2 external 1080p monitors. The scaling is fine normally, with the native monitor at 125% and the 1080p monitors at 100%, but when I undock the laptop, sometimes the laptop goes to 200% scaling factor and I need to reset it manually in display settings.



      I would like to find a command that emulates the setting here, such that I don't need to right click on the desktop and open display settings every time I unplug my external monitors:



      enter image description here



      The only registry keys/PowerShell commands I've found for this require logging out to take effect, which doesn't seem necessary given the GUI setting can take effect immediately.










      share|improve this question
















      I've got a laptop with a 2560 x 1440 display, connected to 2 external 1080p monitors. The scaling is fine normally, with the native monitor at 125% and the 1080p monitors at 100%, but when I undock the laptop, sometimes the laptop goes to 200% scaling factor and I need to reset it manually in display settings.



      I would like to find a command that emulates the setting here, such that I don't need to right click on the desktop and open display settings every time I unplug my external monitors:



      enter image description here



      The only registry keys/PowerShell commands I've found for this require logging out to take effect, which doesn't seem necessary given the GUI setting can take effect immediately.







      windows-10 multiple-monitors dpi scaling






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 28 '18 at 1:55









      JakeGould

      31.6k1096138




      31.6k1096138










      asked Jun 27 '18 at 20:29









      JustinJustin

      1814




      1814






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Below is a batch script that will emulate the keyboard strokes to manipulate the GUI to adjust the Scale and layout options and Change the size or text, apps, and other items when it runs. This uses ms-settings:display to open the Display screen, and then it presses the tab key once and the up arrow 5 times using sendkeys to adjust the scale accordingly. It will press Alt+F4 at the end keys to close the screen once it completes. This method builds a dynamic vb script with a batch script and then executes the vb script with cscript to emulate pressing the keyboard keys.





          Batch Script



          Note: Just save this to a text file with a .bat or .cmd extension and execute it to run.



          @ECHO OFF

          explorer ms-settings:display
          ping -n 2 127.0.0.1 > nul

          :VBSDynamicBuild
          SET TempVBSFile=%tmp%~tmpSendKeysTemp.vbs
          IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
          ECHO Set WshShell = WScript.CreateObject("WScript.Shell") >>"%TempVBSFile%"
          ECHO Wscript.Sleep 500 >>"%TempVBSFile%"
          ECHO WshShell.SendKeys "{TAB}{UP 5}" >>"%TempVBSFile%"
          ECHO Wscript.Sleep 500 >>"%TempVBSFile%"
          ECHO WshShell.SendKeys "%%{F4}" >>"%TempVBSFile%"

          CSCRIPT //nologo "%TempVBSFile%"
          EXIT




          Further Resources




          • Launch the Windows Settings app

          • SendKeys

          • CScript






          share|improve this answer
























          • @Justin - Let me know how it goes when you test this. The {Tab} and {Up 5} may need adjusted but from a larger scale to a smaller scale on my system it was just one tab and then a few up arrow presses but I put 5 because it can go up once at 100% more than that and it'll stay at 100% still from what I tested. The number [#] next to the {TAB #} or {UP #} indicates the number of times that key needs to be pressed on the GUI to go to each option so these may be different on your system but I tested as best I could here and that's what seems to work for me.

            – Pimp Juice IT
            Jun 28 '18 at 5:44











          • Perfect. I had to modify it a bit to send more {Tab}s but this definitely will do the trick.

            – Justin
            Jun 28 '18 at 19:05











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1334781%2fis-it-possible-to-change-display-scaling-via-command-line%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          Below is a batch script that will emulate the keyboard strokes to manipulate the GUI to adjust the Scale and layout options and Change the size or text, apps, and other items when it runs. This uses ms-settings:display to open the Display screen, and then it presses the tab key once and the up arrow 5 times using sendkeys to adjust the scale accordingly. It will press Alt+F4 at the end keys to close the screen once it completes. This method builds a dynamic vb script with a batch script and then executes the vb script with cscript to emulate pressing the keyboard keys.





          Batch Script



          Note: Just save this to a text file with a .bat or .cmd extension and execute it to run.



          @ECHO OFF

          explorer ms-settings:display
          ping -n 2 127.0.0.1 > nul

          :VBSDynamicBuild
          SET TempVBSFile=%tmp%~tmpSendKeysTemp.vbs
          IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
          ECHO Set WshShell = WScript.CreateObject("WScript.Shell") >>"%TempVBSFile%"
          ECHO Wscript.Sleep 500 >>"%TempVBSFile%"
          ECHO WshShell.SendKeys "{TAB}{UP 5}" >>"%TempVBSFile%"
          ECHO Wscript.Sleep 500 >>"%TempVBSFile%"
          ECHO WshShell.SendKeys "%%{F4}" >>"%TempVBSFile%"

          CSCRIPT //nologo "%TempVBSFile%"
          EXIT




          Further Resources




          • Launch the Windows Settings app

          • SendKeys

          • CScript






          share|improve this answer
























          • @Justin - Let me know how it goes when you test this. The {Tab} and {Up 5} may need adjusted but from a larger scale to a smaller scale on my system it was just one tab and then a few up arrow presses but I put 5 because it can go up once at 100% more than that and it'll stay at 100% still from what I tested. The number [#] next to the {TAB #} or {UP #} indicates the number of times that key needs to be pressed on the GUI to go to each option so these may be different on your system but I tested as best I could here and that's what seems to work for me.

            – Pimp Juice IT
            Jun 28 '18 at 5:44











          • Perfect. I had to modify it a bit to send more {Tab}s but this definitely will do the trick.

            – Justin
            Jun 28 '18 at 19:05
















          2














          Below is a batch script that will emulate the keyboard strokes to manipulate the GUI to adjust the Scale and layout options and Change the size or text, apps, and other items when it runs. This uses ms-settings:display to open the Display screen, and then it presses the tab key once and the up arrow 5 times using sendkeys to adjust the scale accordingly. It will press Alt+F4 at the end keys to close the screen once it completes. This method builds a dynamic vb script with a batch script and then executes the vb script with cscript to emulate pressing the keyboard keys.





          Batch Script



          Note: Just save this to a text file with a .bat or .cmd extension and execute it to run.



          @ECHO OFF

          explorer ms-settings:display
          ping -n 2 127.0.0.1 > nul

          :VBSDynamicBuild
          SET TempVBSFile=%tmp%~tmpSendKeysTemp.vbs
          IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
          ECHO Set WshShell = WScript.CreateObject("WScript.Shell") >>"%TempVBSFile%"
          ECHO Wscript.Sleep 500 >>"%TempVBSFile%"
          ECHO WshShell.SendKeys "{TAB}{UP 5}" >>"%TempVBSFile%"
          ECHO Wscript.Sleep 500 >>"%TempVBSFile%"
          ECHO WshShell.SendKeys "%%{F4}" >>"%TempVBSFile%"

          CSCRIPT //nologo "%TempVBSFile%"
          EXIT




          Further Resources




          • Launch the Windows Settings app

          • SendKeys

          • CScript






          share|improve this answer
























          • @Justin - Let me know how it goes when you test this. The {Tab} and {Up 5} may need adjusted but from a larger scale to a smaller scale on my system it was just one tab and then a few up arrow presses but I put 5 because it can go up once at 100% more than that and it'll stay at 100% still from what I tested. The number [#] next to the {TAB #} or {UP #} indicates the number of times that key needs to be pressed on the GUI to go to each option so these may be different on your system but I tested as best I could here and that's what seems to work for me.

            – Pimp Juice IT
            Jun 28 '18 at 5:44











          • Perfect. I had to modify it a bit to send more {Tab}s but this definitely will do the trick.

            – Justin
            Jun 28 '18 at 19:05














          2












          2








          2







          Below is a batch script that will emulate the keyboard strokes to manipulate the GUI to adjust the Scale and layout options and Change the size or text, apps, and other items when it runs. This uses ms-settings:display to open the Display screen, and then it presses the tab key once and the up arrow 5 times using sendkeys to adjust the scale accordingly. It will press Alt+F4 at the end keys to close the screen once it completes. This method builds a dynamic vb script with a batch script and then executes the vb script with cscript to emulate pressing the keyboard keys.





          Batch Script



          Note: Just save this to a text file with a .bat or .cmd extension and execute it to run.



          @ECHO OFF

          explorer ms-settings:display
          ping -n 2 127.0.0.1 > nul

          :VBSDynamicBuild
          SET TempVBSFile=%tmp%~tmpSendKeysTemp.vbs
          IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
          ECHO Set WshShell = WScript.CreateObject("WScript.Shell") >>"%TempVBSFile%"
          ECHO Wscript.Sleep 500 >>"%TempVBSFile%"
          ECHO WshShell.SendKeys "{TAB}{UP 5}" >>"%TempVBSFile%"
          ECHO Wscript.Sleep 500 >>"%TempVBSFile%"
          ECHO WshShell.SendKeys "%%{F4}" >>"%TempVBSFile%"

          CSCRIPT //nologo "%TempVBSFile%"
          EXIT




          Further Resources




          • Launch the Windows Settings app

          • SendKeys

          • CScript






          share|improve this answer













          Below is a batch script that will emulate the keyboard strokes to manipulate the GUI to adjust the Scale and layout options and Change the size or text, apps, and other items when it runs. This uses ms-settings:display to open the Display screen, and then it presses the tab key once and the up arrow 5 times using sendkeys to adjust the scale accordingly. It will press Alt+F4 at the end keys to close the screen once it completes. This method builds a dynamic vb script with a batch script and then executes the vb script with cscript to emulate pressing the keyboard keys.





          Batch Script



          Note: Just save this to a text file with a .bat or .cmd extension and execute it to run.



          @ECHO OFF

          explorer ms-settings:display
          ping -n 2 127.0.0.1 > nul

          :VBSDynamicBuild
          SET TempVBSFile=%tmp%~tmpSendKeysTemp.vbs
          IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
          ECHO Set WshShell = WScript.CreateObject("WScript.Shell") >>"%TempVBSFile%"
          ECHO Wscript.Sleep 500 >>"%TempVBSFile%"
          ECHO WshShell.SendKeys "{TAB}{UP 5}" >>"%TempVBSFile%"
          ECHO Wscript.Sleep 500 >>"%TempVBSFile%"
          ECHO WshShell.SendKeys "%%{F4}" >>"%TempVBSFile%"

          CSCRIPT //nologo "%TempVBSFile%"
          EXIT




          Further Resources




          • Launch the Windows Settings app

          • SendKeys

          • CScript







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 28 '18 at 5:41









          Pimp Juice ITPimp Juice IT

          24.8k114075




          24.8k114075













          • @Justin - Let me know how it goes when you test this. The {Tab} and {Up 5} may need adjusted but from a larger scale to a smaller scale on my system it was just one tab and then a few up arrow presses but I put 5 because it can go up once at 100% more than that and it'll stay at 100% still from what I tested. The number [#] next to the {TAB #} or {UP #} indicates the number of times that key needs to be pressed on the GUI to go to each option so these may be different on your system but I tested as best I could here and that's what seems to work for me.

            – Pimp Juice IT
            Jun 28 '18 at 5:44











          • Perfect. I had to modify it a bit to send more {Tab}s but this definitely will do the trick.

            – Justin
            Jun 28 '18 at 19:05



















          • @Justin - Let me know how it goes when you test this. The {Tab} and {Up 5} may need adjusted but from a larger scale to a smaller scale on my system it was just one tab and then a few up arrow presses but I put 5 because it can go up once at 100% more than that and it'll stay at 100% still from what I tested. The number [#] next to the {TAB #} or {UP #} indicates the number of times that key needs to be pressed on the GUI to go to each option so these may be different on your system but I tested as best I could here and that's what seems to work for me.

            – Pimp Juice IT
            Jun 28 '18 at 5:44











          • Perfect. I had to modify it a bit to send more {Tab}s but this definitely will do the trick.

            – Justin
            Jun 28 '18 at 19:05

















          @Justin - Let me know how it goes when you test this. The {Tab} and {Up 5} may need adjusted but from a larger scale to a smaller scale on my system it was just one tab and then a few up arrow presses but I put 5 because it can go up once at 100% more than that and it'll stay at 100% still from what I tested. The number [#] next to the {TAB #} or {UP #} indicates the number of times that key needs to be pressed on the GUI to go to each option so these may be different on your system but I tested as best I could here and that's what seems to work for me.

          – Pimp Juice IT
          Jun 28 '18 at 5:44





          @Justin - Let me know how it goes when you test this. The {Tab} and {Up 5} may need adjusted but from a larger scale to a smaller scale on my system it was just one tab and then a few up arrow presses but I put 5 because it can go up once at 100% more than that and it'll stay at 100% still from what I tested. The number [#] next to the {TAB #} or {UP #} indicates the number of times that key needs to be pressed on the GUI to go to each option so these may be different on your system but I tested as best I could here and that's what seems to work for me.

          – Pimp Juice IT
          Jun 28 '18 at 5:44













          Perfect. I had to modify it a bit to send more {Tab}s but this definitely will do the trick.

          – Justin
          Jun 28 '18 at 19:05





          Perfect. I had to modify it a bit to send more {Tab}s but this definitely will do the trick.

          – Justin
          Jun 28 '18 at 19:05


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1334781%2fis-it-possible-to-change-display-scaling-via-command-line%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Index of /

          Tribalistas

          Listed building