How can I open a cmd window in a specific location? How can I open a cmd window in a specific location? windows windows

How can I open a cmd window in a specific location?


This might be what you want:

cmd /K "cd C:\Windows\"

Note that in order to change drive letters, you need to use cd /d. For example:

C:\Windows\System32\cmd.exe /K "cd /d H:\Python\"

(documentation)


If you have Windows Vista or later, right-click on the folder icon in Explorer while holding the Shift key, and then click on the "Open command window here" or "Open PowerShell window here" context menu option.

If you're already in the folder you want, you can do one of the following:

  • [only Win8+] Click the Explorer Ribbon's File button, then click on "Open command window here" or "Open PowerShell window here".
  • Shift-right-click on the background of the Explorer window, then click on "Open command window here" or "Open PowerShell window here". (recommended by Kate in the comments)
  • [only Vista or Win7] Hold down Shift when opening the Explorer File menu, then click on "Open command window here". If you can't see the menu bar, open the File menu by pressing Alt-Shift-F - Alt-F to open the File menu, plus Shift.

For Windows XP, use the PowerToy mentioned by dF to get the same function.


Assuming that in File Explorer you have opened the target directory/folder, do this:

  1. Click on address bar, alternatively press Alt+D

  2. Now when address bar is highlighted, type cmd in the bar.

  3. Press Enter key

You will notice that command prompt from that folder