O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  


 
Buy the book!
Windows XP Hacks
By Preston Gralla
February 2005
More Info

HACK
#28
A Power User's Hidden Weapon: Improve the Context Menu
The context menu is an often-underused tool. But with these four additions and edits to the menu, it'll turn into a powerhouse that you'll use every day
[Discuss (1) | Link to this hack]

Windows Explorer's right-click context menu is one of the most basic of all XP tools; it provides many shortcuts for whenever you want to take action on a file or a folder. But the right-click menu is missing several basic options, such as choosing a specific folder to which you want to move or copy the file you've highlighted, instead of just cutting or copying the file. And when you install new applications, they have a nasty habit of adding their own options that you'll rarely use in the right-click menu.

The end result: a right-click context menu cluttered with options and lacking several basic useful ones. But you can extend the power of the menu with these four hacks.

Open the Command Prompt from the Right-Click Menu

I began computing in the days of DOS, and I still can't give up the command prompt. When it comes to doing down-and-dirty tasks like mass deleting or renaming of files, nothing beats it. I find myself frequently switching back and forth between Windows Explorer and the command prompt.

Often, when using Windows Explorer, I want to open the command prompt at the folder that's my current location. That takes too many steps: opening a command prompt and then navigating to my current folder. However, there's a quicker way: you can add an option to the right-click context menu that will open a command prompt at your current folder. For example, if you were to right-click the C:\My Stuff folder, you could then choose to open a command prompt at C:\My Stuff.

To add the option, run the Registry Editor , then go to HKEY_LOCAL_MACHINE/Software/Classes/Folder/Shell. Create a new key called Command Prompt. For the default value, enter whatever text you want to appear when you right-click a folder—for example, Open Command Prompt. Create a new key beneath the Command Prompt key called Command. Set the default value to Cmd.exe /k pushd %L. That value will launch Cmd.exe, which is the XP command prompt. The /k switch puts the prompt into interactive mode. That is, it lets you issue commands from the command prompt; the command prompt isn't being used to issue only a single command and then exit. The pushd command stores the name of the current directory, and %L uses that name to start the command prompt at it. Exit the Registry. The new menu option will show up immediately. Note that it won't appear when you right-click a file; it shows up only when you right-click a folder.

TIP

While many of us like fussing around with the Registry rather than doing things the easy way, there's also a way to add this option to your right-click context menu without editing the Registry. Download and install a free copy of Microsoft's Open Command Window Here PowerToy from http://www.microsoft.com/windowsxp/pro/downloads/powertoys.asp. Many other PowerToys are on that page as well, and we cover them in other places in the book.


O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.