This blog is moved to
http://amalhashim.wordpress.com

Tuesday, March 17, 2009

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

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.

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.

No comments: