How do you open the command prompt in Windows 7 with a shortcut key?

53

11

Is it possible to open the command prompt with Windows 7 with a shortcut key, and if it is, how do you do it?

I know that I can assign a shortcut key to it, but does Windows come with a shortcut key already?

I know in that in Ubuntu, with the Unity desktop environment at least, you can press Ctrl + Alt + T.

Dozer789

Posted 2014-03-14T00:23:52.470

Reputation: 633

Shift + F10 for windows 7 installation interface. So you can run command like diskpart before installation process. – Nick Dong – 2018-02-06T12:43:44.867

2In Linux there may be no such shortcut key, depending on desktop environment. In fact, there rarely is one (except Alt+F2, entering something like xterm or another terminal emulator and pressing Enter, but this is analogous to Windows' WinLogo+R, cmd, Enter). – Ruslan – 2014-03-14T12:37:37.813

@Ruslan I should have said the flavour... I am using Debian 12.04 LTS – Dozer789 – 2014-03-14T22:59:02.083

You must mean Ubuntu 12.04 LTS. There's no such thing as Debian LTS, nor such versions as 12.04 for Debian. – Ruslan – 2014-03-15T04:07:46.810

@Ruslan Sorry, I don't why I said Debian... I meant Ubuntu. – Dozer789 – 2014-03-17T23:13:53.477

Answers

83

For normal prompt, follow these steps:

  • WinKey+R
  • Input "cmd".
  • Enter

.
For elevated (administrator) prompt, follow these steps:

  • WinKey (Start Menu opens on the left-bottom corner)
  • Input "cmd".
  • Ctrl+Shift+Enter
    .

You can, of course, create a special shorcut for your computer, but memorizing the above keys should be useful because they work on every vanilla (untouched) Windows version (NT, XP, Vista, 7, 8, 8.1... even Win98 or 95, if you still use them), and, as far as I know, flavour (Home, Pro, Server, Premium, Ultimate... etc).

EDIT May 2016: Checked working on Windows 10.

Sopalajo de Arrierez

Posted 2014-03-14T00:23:52.470

Reputation: 5 328

There should be an option like "Developer Settings" where you can open a command prompt by a shortcut (and many other things, like create a file with a shortcut). I know that it would annoy the usual user if he accidencially opens CMD and has no idea what is happening (and give him the power to do dangerous things), but to no implements shortcuts at all for stuff like this is a major issue on Windows if you ask me. The method provided in this answer is not satisfying and it also doesn't work with the current directory you're in. – codepleb – 2016-06-30T08:36:20.240

1With Windows 8, 8.1, and 10, you can now use the Admin menu. Press Win+X, A to start the Admin Command Prompt / Admin Power Shell – Canadian Luke – 2016-11-17T18:52:01.193

4+1 This is the best method IMO. Simple, allows for elevated, and works on stock installations. – Ron – 2014-03-14T10:04:41.977

3It seems the ctrl+shift+enter trick doesn't work on Win8.1 though... But there you can select it directly from the menu-popup that's brought up by pressing win+x. – deroby – 2014-03-14T12:44:56.527

I have just tested it working fine on Windows 8. Don't know about v8.1 yet. – Sopalajo de Arrierez – 2014-03-14T13:10:46.920

@SopalajodeArrierez What is the difference between normal prompt and elevated prompt? – Geek – 2014-03-15T18:39:28.587

@Geek elevated prompt is running with administrative privileges. All launched programs will be elevated too. You'll have to confirm UAC dialog in order to start it. – gronostaj – 2014-03-15T19:11:10.393

@Geek, remember that administrative elevation of a program is a concept introduced on Windows Vista and existing since then. If your windows is older, you just don't need to worry about it. Maybe that fact has confused you. Anyway, I have edited the original post to add the word "administrator" for clarity purposes. – Sopalajo de Arrierez – 2014-03-15T19:36:44.733

@deroby: I have finally tested it working OK on Windows 8.1 in a HP Envy portable computer. I don't know why it didn't work for you. – Sopalajo de Arrierez – 2014-04-30T23:21:38.877

3@SopalajodeArrierez turns out to be my own mistake off course. I re-read the issue and then realized that out of habit I pressed Winkey + R, then typed cmd and pressed shift-enter, thus starting it via the "Run"-box. This does not work indeed. Pressing just Winkey and typing cmd starts it via the "Search" and this one does indeed recognize the shift-enter. Sorry for the confusion! – deroby – 2014-05-02T16:56:51.967

32

Easy as. You just need to create a shortcut to the command prompt somewhere to allow you to apply the hotkey combination to it. Here's one way to do it.

  • Hit the Windows button
  • In Search programs and files, type cmd
  • When cmd.exe is found, right-click on it and go Pin to start menu
  • Close and reopen the start menu (or just press Esc)
  • Right click on your new pinned shortcut and choose Properties
  • On the shortcut tab, you will find a field called Shortcut key
  • Select that field and set the key combination you want to use
  • Press OK

Job done!

Iain Fraser

Posted 2014-03-14T00:23:52.470

Reputation: 655

This spawns a new session each time. With normal applications, it's just re-opened/re-focused on when you hit the key-command. The solution in this answer opens the current session, based on its position in the taskbar.

– aliteralmind – 2015-01-13T14:39:57.900

I noticed a couple of MSWindows7 oddities due to the given procedure: 1, although I pressed Win-], the keyboard shortcut entered as Ctrl-Alt-], which works to start cmd, although Win-] does not. 2, cmd started via shortcut begins in C:\Windows\System32 while cmd started via Win-R, cmd begins in C:\Users\JW – James Waldby - jwpat7 – 2016-04-17T18:40:40.227

That is what I was talking about... I know I can set the hot key for it, I was just wondering if there was a pre-set one. – Dozer789 – 2014-03-14T00:39:59.630

5No, there is no preset one. – Iain Fraser – 2014-03-14T00:40:50.233

This is the best way to do it. +1, but someone gave it a -1 – Devid – 2014-03-14T00:45:29.830

I am thinking that setting a shortcut for it is the best way for doing it. +1 from me! – Dozer789 – 2014-03-14T00:46:47.093

Why are people saying there is no preset one? Doesn't Win-R count? Maybe I'm misunderstanding the question... – loneboat – 2014-03-14T17:31:26.330

@loneboat: That opens a dialog where you can type a single commend, but is not a command prompt. still, I use start+r,c,m,d,enter very commonly – Mooing Duck – 2014-03-14T19:58:01.307

1@MooingDuck: Haha, you're right. That's what I do as well (Win-R, cmd, enter). I do it so frequently that in my brain, I thought Win-R WAS a shortcut to Cmd. My mistake. :-) – loneboat – 2014-03-14T22:54:38.317

24

Click Start, and type cmd. Right click the icon, and click Pin to Taskbar. Then, depending on its position, you can press Win + 1-9, depending on its position from the Start orb.

Canadian Luke

Posted 2014-03-14T00:23:52.470

Reputation: 22 162

Perfect!!! It reopens/re-focuses on the current command prompt session, instead of spawning a new one, as in this answer.

– aliteralmind – 2015-01-13T14:41:30.460

This is what I would do. I like that feature. It was even added to Ubuntu. – OregonTrail – 2014-03-14T04:56:50.320

13

Use AutoHotKey for this.

Example(CTRL + Alt + T):

^!t::
Run %comspec% /k
return

Note: comspec is a built-in variable that resolves to C:\Windows\system32\cmd.exe on a typical system.

stderr

Posted 2014-03-14T00:23:52.470

Reputation: 9 300

13

In Windows 7 there's also a convenient way to create a command line window pointing to a folder that is currently open in explorer: Shift + Right-click in that folder and select "Open command window here":
convenient way to create a command line window pointing to a folder
See this sevenforums post for more examples of Shift changing default behavior.

bizzz

Posted 2014-03-14T00:23:52.470

Reputation: 265

Not only cmd: you can use the explorer address bar as a command line input. So you can open any file (with a opening way defined) in any folder in %PATH%, not only .exe but also .bat, .ps1 or even .txt, etc. The selected folder will be the working directory and also any file arg will be looked for there. Just like in cmd. Not much people uses this or even know it. Two cons; if the file is not found, the explorer address bar will try to search the text in your default browser; and if you run a console program you usually can't see the result because the window closes. – cdlvcdlv – 2018-01-07T17:29:51.327

6Even better, in the address bar type cmd – TankorSmash – 2014-03-14T15:09:43.953

Shift+Right click offers this option on desktop as well. – David Starkey – 2014-03-14T17:14:57.727

Also works in Windows 8 / 8.1 – user11153 – 2014-04-08T10:50:30.267

9

The best way !(no typing and no clicking just shortcut key)

  1. Make a shortcut of this cmd.exe file at desktop
  2. Go to the shortcut's properties and there will be a space for shortcut-key ... input any key of your choice (lets say c) then the shortcut key turns to ctrl + alt + c.
  3. Now test it out anywhere!

Another way out (this has 2 key combo)

  1. drag cmd.exe to just beside the windows orb at bottom-left corner of your screen (by default the orb is there)
  2. press winkey + 1(yeah! the key with windows logo and the number 1)

P.S : and the best part of this is that you can have programs which can open with shortcut keys of your choice!

Mukul Kumar

Posted 2014-03-14T00:23:52.470

Reputation: 694

5

Win8+ method:

Win+X, C: CMD

Win+X, A: CMD as admin

FYI: I am aware the question requested a solution on Win7, but I thought this solution was too good NOT to share! :)

gregg

Posted 2014-03-14T00:23:52.470

Reputation: 2 025

1Works in Win10! – Marslo – 2017-08-24T10:20:18.943

Doesn't in W10 - Italian (Win+i run powershell, Win+a run admin powershell) – DDS – 2019-10-22T16:00:51.633

@DDS Yes Win10 v1809 (build 17763) or earlier Microsoft replaced PowerShell instead of Command-Prompt. Switch back: right-click Taskbar, Taskbar settings, toggle this entry OFF: 'Replace Command Prompt with Windows PowerShell in the menu when I right-click the start button or press Windows key+X.' – gregg – 2019-10-23T21:00:44.657

The issue isn't powershell, the issue is that in Italian "C" and "A" arn't the underlined letter, so the press win+x then C/A does not work because the involved letters are different. Anyway thanks for suggestion on how to restore CMD as default command prompt. – DDS – 2019-10-24T13:15:23.860

2

In Windows, any link (.lnk) can have a hotkey assigned. Create a link to cmd.exe, go to its properties and set the hotkey.

Or you can pin any program to a task panel and start it with Win+(digit) combination. Win+1 will start the first icon on the task panel, Win+2 - the second one and so on.

Kirill Gamazkov

Posted 2014-03-14T00:23:52.470

Reputation: 121

1

You can use AutoHotkey to make a keyboard shortcut for the command prompt and set it to any key combination you want. It's easy to set up and use.

Keltari

Posted 2014-03-14T00:23:52.470

Reputation: 57 019

0

Windows does not come with a shortcut key to the command prompt. The closest thing would be the extended context menu (Shift + Right-click) on the Desktop or perhaps just Win + R and then running cmd.

Matt

Posted 2014-03-14T00:23:52.470

Reputation: 235

How do I add one of those to the cmd? – Dozer789 – 2014-03-14T00:33:02.353

On Windows 7, Shift + Right-click on the Desktop should give you an option that says "Open command window here." If you'd like a right-click option to be available anywhere, I've found Ultimate Windows Context Menu Customizer to be helpful.

– Matt – 2014-03-14T00:35:37.623

That Ultimate Windows Context Menu Customizer looks useful. I'll look into that. – Dozer789 – 2014-03-14T00:41:15.963

0

If you are a keyboard guy, you will like Launchy.

Launchy indexes the entries in the start menu (configurable, other places are possible too). Now, you hit Alt+SPACE and the Launchy window opens.

Type cmd and the console opens.

IMO a much more natural way to start applications (by their name) than Autohotkey.

eckes

Posted 2014-03-14T00:23:52.470

Reputation: 418

1It's quite unnatural to install a special tool to run an executable in %PATH%. WinLogo+R can do this, and it's available by default. – Ruslan – 2014-03-14T12:40:01.043

1Yep. Things get interesting when you want to start something not in %PATH%. Or if you not only want to start an executable but for example open a word document, calculate something quickly etc. Launchy handles all that. Give it a try. Once you've used it you'll never want to miss it again -- if you're a keyboard guy. If you're fine with clicking through the explorer, Launchy is not for you. – eckes – 2014-03-14T12:44:51.210

1It's overkill for the OP's question. As for myself, I don't use Windows, I'm happy with Yakuake @ Linux :) – Ruslan – 2014-03-14T12:48:32.123

@Ruslan: yep. Solves more that OPs problem. Give a man a fish... you know? – eckes – 2014-03-14T12:50:49.940

0

Not quite a shortcut key, but still only a mouse-click and 4 keystrokes away: Since Vista, in File Explorer editing the "breadcrumbs" address and overwriting it with cmd and pressing Enter will start cmd.exe and a bonus: it starts it in the folder you're currently displaying.

Mark Hurd

Posted 2014-03-14T00:23:52.470

Reputation: 379

0

Simply type cmd into the address bar of an explorer window. It will open a command window in the current location.

felwithe

Posted 2014-03-14T00:23:52.470

Reputation: 383

0

I have a collection of productivity tools. You can find how do I open cmd window at Open Command Window:

If Win+c is pressed in windows explorer, the opened command line window will use the same path in the windows explorer as the current directory

If you don't want to get the whole rwin package. The closest is to put the cursor in windows explorer and type in "cmd" to get the command window in the current directory.

Codism

Posted 2014-03-14T00:23:52.470

Reputation: 845

-1

It is better to:

  • Create a custom shortcut of CMD.EXE on the desktop
  • Go to properties of shortcut you have created
  • Assign a custom key to whatever you want in the shortcut key textbox
  • Press the shortcut key on the keyboard, and it starts opening

Vikash

Posted 2014-03-14T00:23:52.470

Reputation: 1

-2

Depending on what you are looking for, the simplest method is hit Ctrl-M with the explorer window open. A power shell command prompt opens on the directory where you are working at.

Angus Tin

Posted 2014-03-14T00:23:52.470

Reputation: 1