You are currently offline, waiting for your internet to reconnect

How to start a command prompt in a folder in Windows Server 2003, Windows XP, and Windows 2000

Support for Windows XP has ended

Microsoft ended support for Windows XP on April 8, 2014. This change has affected your software updates and security options. Learn what this means for you and how to stay protected.

Support for Windows Server 2003 ended on July 14, 2015

Microsoft ended support for Windows Server 2003 on July 14, 2015. This change has affected your software updates and security options. Learn what this means for you and how to stay protected.

This article was previously published under Q320148
SUMMARY
This step-by-step article describes how to open a command prompt in a folder on a computer that is running any of the following operating systems:
  • Microsoft Windows Server 2003
  • Microsoft Windows XP
  • Microsoft Windows 2000
If you use a command prompt frequently, it may be helpful to start a command prompt in a specific folder instead of using the cd command to move to the folder that you want. You can place a Command Prompt command on the shortcut menu in My Computer or Windows Explorer to start a command prompt in the folder that you want.

You must modify the registry to add the Command Prompt command. You can modify the registry manually, or you can use a script.back to the top

To Add a "Command Prompt" Command

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows

back to the top

Modify the Registry Manually

To add the Command Prompt command to the shortcut menu:
  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate the following registry key:
    HKEY_CLASES_ROOT\Directory\shell
  3. Right-click the shell key, point to New, and then click Key.
  4. Name the new key OpenNew.
  5. Click the OpenNew key, and then double-click the Default value in the right pane.
  6. Change the value to Command Prompt. Click OK.
  7. Right-click the OpenNew key, point to New, and then click Key.
  8. Name the new key Command.
  9. Double-click the Default item in the right pane.
  10. Change the value to cmd.exe /k cd %1.
If you have multiple drives on your computer, you can add a similar command to the shortcut menu that appears when you right-click a drive in Windows Explorer or My Computer. The steps to do this are the same as those for creating the Command Prompt command, except that you use the HKEY_CLASSES_ROOT\Drive\shell registry key as the starting point. Also, change the value of the Default value in the HKEY_CLASSES_ROOT\Drive\shell\OpenNew\Command key to cmd.exe /k.

back to the top

Modify the Registry with a Script

To add the Command Prompt command to the shortcut menu:
  1. Copy the following text to a file named Cmdhere.reg:
    Windows Registry Editor Version 5.00
    [HKEY_CLASSES_ROOT\Directory\shell\OpenNew]
    @="Command Prompt"
    [HKEY_CLASSES_ROOT\Directory\shell\OpenNew\Command]
    @="cmd.exe /k cd %1"
  2. Save the Cmdhere.reg file.
  3. Double-click the Cmdhere.reg file to automatically add the registry entries.
back to the top
Properties

Article ID: 320148 - Last Review: 11/01/2006 15:49:11 - Revision: 4.3

Microsoft Windows Server 2003, Standard Edition (32-bit x86), Microsoft Windows Server 2003, Enterprise Edition (32-bit x86), Microsoft Windows Server 2003, Web Edition, Microsoft Windows XP Professional, Microsoft Windows XP Home Edition, Microsoft Windows 2000 Server, Microsoft Windows 2000 Advanced Server, Microsoft Windows 2000 Professional Edition

  • kbhowtomaster KB320148
Feedback
FirePV = 1; var varClickTracking = 1; var varCustomerTracking = 1; var Route = "76500"; var Ctrl = ""; document.write(" ="{{'language-'+language.locale}}" href="" ng-click="setLanguage(language);" class="ng-binding" id="language-es-uy">Uruguay - Español
대한민국 - 한국어
España - Español
Paraguay - Español
Venezuela - Español
id=1&t="> var varClickTracking = 1; var varCustomerTracking = 1; var Route = "76500"; var Ctrl = ""; document.write(" d')[0].appendChild(m);" onload="var m=document.createElement('meta');m.name='ms.dqp0';m.content='false';document.getElementsByTagName('head')[0].appendChild(m);" src="http://c1.microsoft.com/c.gif?"> >