When a Windows Vista user shift-clicks on a folder in Explorer, the context menu option "Open Command Window Here" comes up. Clicking on it gives you a command prompt that's started in the desired folder—a handy way to quickly get a command prompt to a buried folder that has a long pathname.
The bad news is that the command prompt is only a regular-user prompt, not an elevated (administrative) command prompt. If you want to do anything that requires an admin-level login, you have to open it manually from the Start menu and drill down to the needed folder. This is a problem for me because some of my system's folders have Unicode pathnames, which I have trouble drilling down to from a command prompt.
Thankfully, the Winhelponline.com blog has published a way to
The blog offers two versions of this trick: one for adding an elevated prompt to a folder context menu, another for adding an elevated command prompt to the My Computer context menu. Both incarnations of the trick use the RunAs command as a context menu handler for a command prompt. RunAs does the actual elevation, since CMD itself doesn't have a switch for running an instance of itself in Admin mode.
Once you install the Registry patch, you should see an "Open Command Windows Here (Administrator)" option along with the User Account Control (UAC) "shield" icon in the right-click context menu for a folder (or Explorer, depending on which script you're using).
Note: If you use this trick, you'll still be prompted for a UAC confirmation whenever you invoke the admin command prompt from a context menu—assuming, of course, UAC is turned on.
About the author: Serdar Yegulalp is editor of the Windows Insight, (formerly the Windows Power Users Newsletter), a blog site devoted to hints, tips, tricks and news for users and administrators of Windows NT, Windows 2000, Windows XP, Windows Server 2003 and Vista. He has more than 12 years of Windows experience under his belt, and contributes regularly to SearchWinComputing.com and SearchSQLServer.com.
More information on this topic:
- Tip: Use RunAs to
run Explorer window with elevated privileges in IE7
- Topics: Windows
- RSS: Sign
up for our RSS feed to receive expert advice every day.
This was first published in May 2007