To use Win R CMD, press the Windows logo key and R together, type cmd in the box that appears and press Enter. Command Prompt opens in a new window, and the same dialog can start other tools by name, such as powershell, msinfo32 and mstsc.
The quickest sequence, in full:
- Press Win+R. Microsoft's keyboard shortcut list describes it as "Open the Run dialog box."
- Type
cmd. - Press Enter.
What the Run dialog actually does
The Run dialog is a one-line launcher. You type the name of a program, and Windows starts it. It is not a command prompt itself, which matters for the next section: it does not keep a window open for programs that print text and finish.
The Microsoft documentation for the start command gives a useful picture of how Windows resolves a name. If the first word is not a full path to an existing file, cmd.exe uses the PATHEXT environment variable to decide which extensions to try, and the default value is .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC. That documentation describes cmd.exe running the lookup, so treat it as a close model of what happens in Run rather than a statement about the dialog itself. It explains why typing cmd finds cmd.exe without the extension.
Win R cmd: open Command Prompt
Typing cmd starts a new instance of the command interpreter, cmd.exe. Without parameters, Microsoft says it displays the version and copyright information of the operating system and then waits for you to type.
Type exit to close the window.
Run a command and keep the window open: cmd /k
This is the most useful trick for the Run dialog. The cmd command takes two switches that matter here:
| Switch | What Microsoft's documentation says it does |
|---|---|
/c | Carries out the command specified by the string and then exits the command processor. |
/k | Carries out the command specified by the string and keeps the command processor running. |
So, to see the output of a command that would otherwise flash and vanish, type this in Run:
cmd /k ipconfig
A Command Prompt window opens, runs ipconfig, shows the result and stays open so you can read it or type more commands. With /c the same window would close as soon as ipconfig finished, which is useful in scripts and shortcuts but not when you want to read the output.
You can chain several commands in the string. Microsoft documents && as the separator that runs the next command only if the previous one succeeded:
cmd /k cd C:\Windows && dir
Here C:\Windows is just an example folder. Special characters such as &, | and parentheses must be escaped with ^ or put inside quotation marks when they are passed as arguments, according to the same page.
Other things worth typing in Run
These names all appear in Microsoft's Windows commands reference or its keyboard and tool documentation. They work as Run dialog entries because they are programs Windows can find by name.
| Type this | What opens |
|---|---|
cmd | Command Prompt (cmd.exe). |
powershell | Windows PowerShell. |
msinfo32 | The System Information tool, a view of the hardware, system components and software environment on the local computer. |
mstsc | Remote Desktop Connection, which creates connections to Remote Desktop Session Host servers or other remote computers. |
regedit | The Registry Editor. Microsoft's cmd documentation names Regedit.exe as the tool for editing registry values, with a warning that incorrect edits might severely damage your system. |
cleanmgr | Disk Cleanup, listed in the Windows commands reference. |
perfmon | Performance Monitor, listed in the Windows commands reference. |
Several of these accept parameters, and you can add them in the Run box. The Microsoft documentation gives these examples, which you can type directly:
mstsc /v:computer1 /fullscreen
msinfo32 /nfo syssum.nfo /categories +systemsummary
The first connects to a computer named computer1 in full-screen mode (the name is a placeholder from the documentation). The second shows System Summary information and creates a file called syssum.nfo that contains it. A bare file name leaves the save folder up to the working directory, so give a full path such as C:\Temp\syssum.nfo when you want to find the file again.
Open a folder or a web address from Run
The documentation for start says you can run non-executable files through their file association by typing the name of the file as a command. It lists URLs, which are opened in the default browser, and documents such as .txt or .pdf files, which open in their associated application. It also says that if a name matches a directory, start opens Explorer.exe on that path. That page describes the start command, not the Run dialog, so test the behavior on your own computer before you rely on it. If you want a guaranteed result from a Command Prompt, the documented example is:
start "Bing" "https://www.bing.com"
The first quoted string is the window title and the second is the address.
Run a command as administrator
Some commands, such as changes to disks or services, need an elevated prompt. Holding Ctrl+Shift while pressing Enter in the Run dialog is widely reported to start the program as administrator. The Microsoft pages I opened for this article do not document it, so treat it as a tip to verify rather than a guarantee. A reliable alternative is to search for Command Prompt in the Start menu, right-click it and choose Run as administrator.
Run a script from the Run dialog
For a batch file, type the full path in quotes if it contains spaces, for example "C:\Scripts\backup.bat". For a PowerShell script, hand it to PowerShell explicitly so that it does not depend on file associations:
powershell -NoExit -File "C:\Scripts\script.ps1"
The -NoExit switch keeps the window open, in the same way cmd /k does for Command Prompt. If the script is blocked, the cause is almost always the execution policy, which is covered in How to Run a PS1 File in Windows PowerShell. If you are new to scripts that Command Prompt runs, What is a BAT file explains the format, and PowerShell basic commands lists what to type once the window is open.
If Win+R does nothing or the command fails
- Nothing opens when you press Win+R. Some keyboards have a Windows key lock or a game mode that disables the Windows key, and a managed work computer may restrict it. Check for a lock switch or a function-key toggle, then try again. As a fallback, right-click the Start button and look for a Run entry.
- The window flashes and closes. The program ran and exited. Use
cmd /kbefore the command to keep it open. - "Windows cannot find" the name. The program is not in a location Windows searches. Type the full path, in quotes if it has spaces.
- A parameter is ignored. Check the exact syntax in the program's reference page, because switches differ between tools. For
cmd, runcmd /?to display help at the command prompt, as Microsoft documents.
Frequently asked questions
- What does Win+R do?
- Win+R (the Windows logo key plus R) opens the Run dialog box, according to Microsoft's list of Windows keyboard shortcuts. You type the name of a program, command or file in it and press Enter to start it.
- What is the difference between cmd /c and cmd /k?
- Both start a new command interpreter and carry out the text that follows. Microsoft documents /c as carrying out the command and then exiting, and /k as carrying out the command and keeping the command processor running. In the Run dialog, /k leaves a window open so you can read the output.
- Why does a window flash and disappear when I type a command in Run?
- Run starts the program directly. A console program such as ipconfig opens its own window, prints its output and exits, so the window closes. Type cmd /k followed by the command instead, for example cmd /k ipconfig, and the window stays open.
- Does Win+R work in PowerShell or Windows Terminal?
- Win+R is a Windows shortcut, not a feature of a shell, so it works wherever you are. Type powershell in the Run dialog to open Windows PowerShell, or cmd to open Command Prompt.