Display command line windows

How to change screen resolution using command line on Windows 10

You can change your computer’s screen resolution using Command Prompt on Windows 10, you just need the right tool — Here’s how.

Although you can always change the screen resolution using the Display settings, Windows 10 doesn’t include a command line equivalent to adjust the resolution using Command Prompt or PowerShell.

This is a feature that would come in handy to quickly change the screen resolution for certain apps and games that work best at specific resolutions. Also, using a command line tool allows to automate the process with a script and even using Task Scheduler.

However, if you’re looking to change the resolution of your device monitor with command line, you can use QRes by Anders Kjersem, which is a tiny (legacy) tool that doesn’t require installation, and it’s been designed to adjust the display pixel resolution through Command Prompt.

In this guide, you’ll learn the steps to select a different display resolution for your monitor on Windows 10 using command line.

Change screen resolution using Command Prompt

To change screen resolution with command line on Windows 10, use these steps:

Right-click the QRes.zip file and select the Extract All button.

Click the Extract button.

Type CMD and press Enter in add “QRes” folder address bar to open Command Prompt in the location.

Type the following command to change the screen resolution and press Enter:

Change screen resolution using Command Prompt

In the command make sure to change the path for the QRes.exe file, and enter a supported width (x) and height (y) pixel resolution. For example, 1366 x 768, 1440 x 900, 1680 x 1050, 1920 x 1080, 2560 x 1440, etc.

Once you complete the steps, the screen will change to the resolution you specified.

Change screen resolution using script

Alternatively, you can use QRes to create a file script that you can simply double-click or schedule with Task Scheduler to change the display resolution automatically.

To create a script to change the screen resolution on Windows 10, use these steps:

Open Start.

Search for Notepad and click the top result to open the app.

Copy and paste the following command:

Script to change resolution automatically

In the command make sure to change the path for the QRes.exe file, and enter a supported width (x) and height (y) pixel resolution. For example, 1366 x 768, 1440 x 900, 1680 x 1050, 1920 x 1080, 2560 x 1440, etc.

Click the File menu.

Select the Save As option.

Save the batch file with a descriptive name and a .bat file extension.

After you complete the steps, double-click the batch file and the screen resolution should change automatically without the need for extra steps.

If you need to change the display resolution constantly, it’s recommended to create another batch file to restore the original resolution. You can always find out about all the solutions supported by your monitor on Settings > System > Display.

Although QRes is an old program, it doesn’t require installation and works as advertised. You may be able to find other tools, but they may required installation of additional software, and they won’t be as easy to use.

We may earn commission for purchases using our links to help keep offering the free content. Privacy policy info.

All content on this site is provided with no warranties, express or implied. Use any information at your own risk. Always backup of your device and files before making any changes. Privacy policy info.

Читайте также:  Forex терминал для linux

Change Display Arrangement via Batch/Command Line on Windows 7

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:

9 Answers 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.

Hope this help. Let us know.

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.

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!

Turn off display in Windows on command

Is there a way to turn off the display in Windows (7), preferably without using additional software?

Powershell script works fine, but leaves command-line window after turning on the display.

4 Answers 4

On a laptop you can use the keyboard shortcut combination of Fn+F7 (F7 might differ depending on the laptop model) and for a desktop you can always use the power button.

Do you need any other specifications such as wake up on mouse movement or something else?

You can always create a shortcut and assign a keyboard shortcut to a black screensaver, use this path:

Читайте также:  Кто был основателем операционной системы windows

This will not turn off you screen but make it completely black

A couple more options:

  • Turn Off LCD — just place the executable on your desktop
  • NirCmd — you’ll need to copy nircmd.exe to your Windows system directory, or add its location to the PATH environment variable. Then just run nircmd monitor off from the command line. More information at the link.

You can use WinAPI call SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2) where HWND_BROADCAST = 0xFFFF , WM_SYSCOMMAND = 0x0112 and SC_MONITORPOWER = 0xF170 . The 2 means the display is being shut off.

There are several ways to make the call:

Separate executable. You can fire it through a script, command line, Run window, shortcut ( *.lnk ), etc. Note that shortcuts can be invoked using a keyboard shortcut. The executable may be written in C or C++, or via P/Invoke in .NET languages (C# or PowerShell), or in many other languages that have a foreign language interface (e.g. JNI in Java).

AutoHotkey script. For a non-programmer, this way is probably simpler. Making customizations still requires some scripting. This script turns monitor off on Win + M:

Note the timeout before the SendMessage call in the AutoHotkey script. It gives the user a chance to release keys (in case their release would wake up the monitor again). Do not forget about it even when making the call from a script in another language.

For more info, see the documentation of SendMessage function, WM_SYSCOMMAND message and AutoHotkey SendMessage . It might be of interest that since Windows 8, using the same method to turn monitor on does not work, but there is a work-around.

Any way of changing Windows screen resolution via command line?

I am using Microsoft’s Live Mesh program to remotely access a PC running Windows 7, running on 2 screens: one with 1920×1080 and the other 1920×1200 resolution.

I am accessing them via an old laptop with 1024×1078 resolution. The result is such tiny icons/commands that it is difficult to try and change the screen resolution from 2 high-res displays to the single low res display.

It would be great if there was a command line way of doing this. Or perhaps there is way through live mesh to do it. Any ideas?

8 Answers 8

The nircmd freeware tool can do this.
To change the display to 1024 x 768 with a 24 bit color depth:

nircmd.exe setdisplay 1024 768 24

nircmd also has other very numerous functions.

I found a Windows Powershell script sample, provided by Microsoft Technet, that is able to change the screen resolution.

The best way to invoke it, I found, was from a separate Powershell script, that looks like this:

(Note I had saved the Microsoft script as Set-ScreenResolution.ps1 )

Then from the command line or Start->Run you can invoke the second Powershell script, which I named Invoke-Set-ScreenResolution.ps1 like this (the -noexit param is good at first for debugging, but you may want to remove it later on depending on whether you want the command window to close):

I used a combination of Qres.exe and Sleep.exe (put these in your Windows folder) in startup batch files to change resolution among 2 users. The actual script is as follows:

(Whereas the low-res copy is Qres.exe /x:800 /y:600 )

If you want your icons to stay where you want them. read on.
You’ll need two more downloads:

Install Startup Delayer and place DesktopOK wherever you like, I used my ‘user’ folder. Organize your desktop, how you want it to be on every reboot.

In DesktopOK go to Options and tick «Restore by Windows Startup», right click on the newly made «Icon Layout» and click «Use this for: Restore at Windows Startup».
At this point you’ll need to also check «Start DesktopOK with windows». The later two options will be unchecked automatically by of Startup Delayer later on.

Читайте также:  Как смонтировать образ windows через ultraiso

Now locate DesktopOK in Startup Delayer and right-click «Delay» it.

Now there’s only one thing left to do, make your startup batch file.

Of course you’ll need to put it in your startup folder, the reason the process is so extensive with the icons is because DesktopOK can’t handle the resolution switch, and wants to move icons while the resolution is being changed, so we needed to delay the registry startup, and this is the only way I found. I don’t dare claim this to be the best way, but I do claim it works, I found no other way, and I came up with the process myself. It gets around every aspect of the situation by replacing icons where they belong per-user.

How do I display a text file content in CMD?

I want to display the content of a text file in a CMD window. In addition, I want to see the new lines that added to file, like tail -f command in Unix.

12 Answers 12

You can use the more command. For example:

We can use the ‘type’ command to see file contents in cmd.

More information can be found HERE.

I don’t think there is a built-in function for that

This opens the files in the default text editor in windows.

This displays the file in the current window. Maybe this has params you can use.

There is a similar question here: CMD.EXE batch script to display last 10 lines from a txt file So there is a «more» command to display a file from the given line, or you can use the GNU Utilities for Win32 what bryanph suggested in his link.

You can use the ‘more’ command to see the content of the file:

Using a single PowerShell command to retrieve the file ending:

It applies to PowerShell 3.0 and newer.

Another option is to create a file called TAIL.CMD with this code:

To do this, you can use Microsoft’s more advanced command-line shell called «Windows PowerShell.» It should come standard on the latest versions of Windows, but you can download it from Microsoft if you don’t already have it installed.

To get the last five lines in the text file simply read the file using Get-Content , then have Select-Object pick out the last five items/lines for you:

If you want it to display the content of the file live, and update when the file is altered, just use this script:

That will repeat forever until you close the cmd window.

You can do that in some methods:

One is the type command: type filename Another is the more command: more filename With more you can also do that: type filename | more

The last option is using a for for /f «usebackq delims=» %%A in (filename) do (echo.%%A) This will go for each line and display it’s content. This is an equivalent of the type command, but it’s another method of reading the content.

If you are asking what to use, use the more command as it will make a pause.

There is no built in option available with Windows. To constantly monitor logs you can use this free application BareTailPro.

You can get the TAIL utility from the Windows Server 2003 Resource Kit Tools.

If you want to display for example all .config (or .ini ) file name and file content into one doc for user reference (and by this I mean user not knowing shell command i.e. 95% of them), you can try this :

  • ForFiles : loop on a directory (and child, etc) each file meeting criteria
    • able to return the current file name being process (@file)
    • able to return the full path file being process (@path)
  • Type : Output the file content
Оцените статью