Thursday, August 23, 2007

3 ways to open command prompt from folder itself.

Try these at your own risk. I am not liable for any sort of damages your computer may suffer due to the following methods. Also, I have tried them myself and everything is fine on my side.

Method #1: Manually add the context menu.

  1. In explorer, open Tools, Folder Options.
  2. Select the File Types tab.
  3. For Windows XP: Go to NONE / Folder.
  4. For Windows 2000: Press n to scroll to the N/A section.
  5. For Windows NT/98/95: Press f to scroll to the Folders section.
  6. Select the entry labeled Folder
  7. For Windows 2000/XP: Press Advanced button.
  8. For Windows NT/98/95: Press Edit button.
  9. Select New
  10. In the action block type "Command Prompt" without the quotes.
  11. In the app block type "cmd.exe" without the quotes.
  12. Save and exit Folder Options.
Method #2: Through batch file

Begin by creating a batch file. For example, you could create a batch file named StartPrompt.cmd. Add the following commands to your batch file:

@echo off
cd /d %1
Title %~f1

  1. Save this batch file to your Windows NT/2000/XP root directory (which is usually C:\WINNT or C:\WINDOWS for XP).
  2. Open Windows Explorer.
  3. Choose View | Options to display the Options dialog box.
  4. Select the File Types tab.
  5. In the list of Registered File Types, select Folder then click Edit.
  6. Click New to display the New Action dialog box.
  7. In the Action text box, type Command Prompt.
  8. In the Application Used To Perform Action text box, type:
  9. cmd.exe /a /k c:\winnt\StartPrompt "%l"
  10. Click OK to close the New Action dialog box, then click Close twice.
Method #3: Through the Registry

  1. Navigate in your Registry to HKEY_LOCAL_MACHINE/Software/Classes/Folder/Shell and create a key called "Command Prompt" without the quotes.
  2. Set the default string to whatever text you want to appear in the right-click menu.
  3. Create a new key within your newly created command prompt named "command," and set the default string to Cmd.exe /k pushd %L. You may need to add %SystemRoot%/ before the Cmd.exe if the executable can't be found.
  4. The changes should take place immediately. Right click a folder and your new menu item should appear.

  1. Playing with registry could be dangerous so take backup of your registry before trying this.
  2. You can do the same for Windows 98. Type in "c:\windows\ /k pushd %L" (without the quotes).

1 comment:

Joel said...

Thanks for this information. I followed the registry instructions in Windows 7 and it works great.