Pages

How can I 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: Through the Registry

This is the simplest, easiest and most idiot-proof method.

Create a text file, type in the following lines and save it as addprompt.reg.



Code:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Command]
@="Command Prompt:"

[HKEY_CLASSES_ROOT\Directory\shell\Command\Command]
@="cmd.exe /k cd %1"


Save this out and double click the file. Note this will modify the registry but I promise it is safe. Your anti-virus software might ask you to confirm the registry change and it is safe to allow it.

This adds Command Prompt to the Windows Explorer right click menu. Just right click on a folder, click Command Prompt and you will be at the command prompt in the selected folder. No need to type CD and the full path anymore.


Method #2: Manually add the context menu

  • In explorer, open Tools, Folder Options.


  • Select the File Types tab.


  • For Windows XP: Go to NONE / Folder.


  • For Windows 2000: Press n to scroll to the N/A section.


  • For Windows NT/98/95: Press f to scroll to the Folders section.


  • Select the entry labeled Folder


  • For Windows 2000/XP: Press Advanced button.


  • For Windows NT/98/95: Press Edit button.


  • Select New


  • In the action block type "Command Prompt" without the quotes.


  • In the app block type "cmd.exe" without the quotes.


  • 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 #3: 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:




    Code:

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



  • Save this batch file to your Windows NT/2000/XP root directory (which is usually C:\WINNT or C:\WINDOWS for XP).


  • Open Windows Explorer.


  • Choose View | Options to display the Options dialog box.


  • Select the File Types tab.


  • In the list of Registered File Types, select Folder then click Edit.


  • Click New to display the New Action dialog box.


  • In the Action text box, type Command Prompt.


  • In the Application Used To Perform Action text box, type:




    Code:

    cmd.exe /a /k c:\winnt\StartPrompt "%l"




  • Click OK to close the New Action dialog box, then click Close twice.

What is svchost.exe And Why Is It Running?

You are no doubt reading this article because you are wondering why on earth there are nearly a dozen processes running with the name svchost.exe. You can't kill them, and you don't remember starting them… so what are they?

So What Is It?

According to Microsoft: "svchost.exe is a generic host process name for services that run from dynamic-link libraries". Could we have that in english please?

Some time ago, Microsoft started moving all of the functionality from internal Windows services into .dll files instead of .exe files. From a programming perspective this makes more sense for reusability… but the problem is that you can't launch a .dll file directly from Windows, it has to be loaded up from a running executable (.exe). Thus the svchost.exe process was born.

Why Are There So Many svchost.exes Running?

If you've ever taken a look at the Services section in control panel you might notice that there are a Lot of services required by Windows. If every single service ran under a single svchost.exe instance, a failure in one might bring down all of Windows… so they are separated out.

Those services are organized into logical groups, and then a single svchost.exe instance is created for each group. For instance, one svchost.exe instance runs the 3 services related to the firewall. Another svchost.exe instance might run all the services related to the user interface, and so on.

So What Can I Do About It?

You can trim down unneeded services by disabling or stopping the services that don't absolutely need to be running. Additionally, if you are noticing very heavy CPU usage on a single svchost.exe instance you can restart the services running under that instance.


If you are curious what we're talking about, just open up Task Manager and check the "Show processes from all users" box:





Checking From the Command Line (Vista or XP Pro)


If you want to see what services are being hosted by a particular svchost.exe instance, you can use the tasklist command from the command prompt in order to see the list of services.



Code:

tasklist /SVC