Windows Tips and Tricks

Friday, February 24, 2006

How to add a Command Prompt option to the default Explorer right click context menu?

If you find that you frequently open a Command Prompt window and change to a specific directory, you can add the Command Prompt to your shortcut menu. This option enables you to right-click on a folder within Windows Explorer and choose the Command Prompt - which opens a Command Prompt window with that folder as your active directory. To add the Command Prompt option to the default right click context menu in Windows Explorer you can do one of the following:

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.
Now right click on Start, you should have a new drop down option. Open explorer and right click on a folder, select Command Prompt and a command window opens in that folder.

Method #2: Through batch file
1. 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 offcd /d %1Title %~f1
2. Save this batch file to your Windows NT/2000/XP root directory (which is usually C:\WINNT or C:\WINDOWS for XP).
3. Open Windows Explorer.
4. Choose View Options to display the Options dialog box.
5. Select the File Types tab.
6. In the list of Registered File Types, select Folder then click Edit.
7. Click New to display the New Action dialog box.
8. In the Action text box, type Command Prompt.
9. In the Application Used To Perform Action text box, type: cmd.exe /a /k c:\winnt\StartPrompt "%l"
10. Click OK to close the New Action dialog box, then click Close twice.
Open Windows NT Explorer, then right-click on a folder. You should now see a new option called "Command Prompt" on the shortcut menu. If you choose this option, Windows Explorer opens a new Command Prompt window with the selected directory as your current directory.

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 %LYou 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.
Note: You can do the same for Windows 98. Type in "c:\windows\command.com /k pushd %L" (without the quotes).

1 Comments:

  • Hi, info is useful.
    i found this page while searching th google. but i was looking some other information. i want to know who is maintaining this blog. can i contact you. pleaaaaase do tell me.
    my email-id is tikeshrane@gmail.com

    By Anonymous Anonymous, at 4:53 AM, May 04, 2006  

Post a Comment

<< Home