Reputation: 841
I have run into a windows exe called nircmd which allows you to do some pretty cool stuff through the command line. I have a project I am assisting in, and am needing to resize a Windows environment on the fly, taking whatever is maximized and making it maximized after the resize. When searching the internet, I stumble upon nircmd a lot, but I can not seem to get the function I need working, to work on it. It is:
setdisplay 800 600 24
I have tried every different option with this function within nircmd, and it does nothing on both a Windows 7 environment, nor a Windows Server where it needs to go. I have googled for "nircmd setdisplay not working" or "nircmd setdisplay error" etc, and can find nothing regarding it on the internet. I find this weird, because I have tested this on my desktop, laptop, and a windows server, and all 3 do nothing.
Can anyone assist me in what I may be doing wrong? Or point me in a direction of a command line driven, on the fly resolution changing program? (I have tried QRes as well, with the same results, though the Windows Server gives me an error (which I don't recall at the moment). It must be command line driven, as this is a simple function that will be inside a php file and only accessed by a few in the end.
Upvotes: 3
Views: 10049
Reputation: 984
This works on Windows 10: https://12noon.com/
Commands example:
Create "active" monitor(s) settings as XML:
dc2.exe -create="DefaultSettings.xml" -active
Load settings:
start /wait "" dc2.exe -configure="DefaultSettings.xml"
^^ This will 1) write your current monitor configuration to an XML file and 2) load those same settings instantly. It really helps to put command 2) into a batch file and run on demand.
Upvotes: 0
Reputation: 61
To refine the answer of Matthew, the key point is that many recent video cards don't accept a color depth of 24 bits at certain resolutions, most of them use 32 bits. That will explain why nircmd.exe setdisplay 800 600 32
will work but nircmd.exe setdisplay 800 600 24
will not. And in that case Nircmd doesn't reply with an error code, the command is accepted but nothing is changed on the display.
Also all the examples in the Nircmd documentation refer to 24 bit or 8 bit, which can cause some frustration until you try with 32.
Upvotes: 6
Reputation: 51
Try:
nircmd.exe setdisplay 800 600 32
or
nircmd.exe setdisplay 800 600 16
Upvotes: 5
Reputation: 24486
There are a few other command-line desktop resolution switchers you can try. One of them is bound to work for you.
(Source, but I had to Google for updated links.)
Upvotes: 1