Click here to Skip to main content
Click here to Skip to main content

.NET Command Prompt Here

By , 22 Aug 2003
 

Introduction

I find the Open Command Window Here utility in the XP Power Toys bundle absolutely indispensable. Put simply, it adds an item to Windows Explorer's context menu that opens a DOS session in the current directory. This article contains and explains two simple registry hacks that add a .NET Command Prompt Here menu item to Windows Explorer's context menu that runs vsvars32.bat and then opens a DOS session in the current directory. I use this in place of the Visual Studio .NET 2003 Command Prompt shortcut installed by VS.NET 2003. It's not magic. Just simple and useful.

Using the code

Unzip dotNET_cmd_here.zip. Double click on both .reg files contained therein, which should be named  .NET Command Prompt Here - Directory.reg and .NET Command Prompt Here - Drive.reg. This adds the .NET Command Prompt Here menu item that is both described and shown above. When you select the menu item, you get something like the DOS session shown below.

Now you can gacutil and ngen to your heart's content.

Points of Interest

Each .reg script has been tested on several XP Pro systems with VS .NET 2003. The command actually added to the registry reads cmd /k "%VS71COMNTOOLS%vsvars32.bat" , which uses the VS71COMNTOOLS variable added to the environment variables by VS.NET 2003. I'm not sure whether VS.NET 2002 adds this variable so, if you're still using VS.NET 2002, look at your environment variables and add the appropriate variable or <kludge>hardcode the path</kludge>.

If you actually look into the .reg scripts, you'll see that the command is written in hex(2). This has to do with the fact that the value is REG_EXPAND_SZ types rather than the default REG_SZ . If you're a registry maven, this is all old hat. For me, however, this was all new. Thus ends my first CodeProject article.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

flipdoubt
Web Developer
United States United States
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralFor VC6.0memberMG Man11 Dec '06 - 19:28 
Replacing "cmd /k ..." to
'cmd /k "C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"'
worked for me.
Generaluninstall method [modified]memberMG Man11 Dec '06 - 18:29 
I found that your reg file does not work for me on VC6.0. I should have noticed that you set this article for VC7.0 or higher.
 
I also found that in order to uninstall we could just delete following registry keys.
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\.net cmd
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\.net cmd
 
If I am wrong, please correct me.

GeneralRe: uninstall methodmemberflipdoubt12 Dec '06 - 3:05 
Looks good to me.
Generalwhidbey versionmemberandy_p3 May '05 - 4:44 
using VS80COMNTOOLS instead: (paste into .reg file then register as usual)
 
Windows Registry Editor Version 5.00
 
[HKEY_CLASSES_ROOT\Directory\shell\whidbey cmd]
@="Whidbey Command Prompt Here"
 
[HKEY_CLASSES_ROOT\Directory\shell\whidbey cmd\command]
@=hex(2):63,00,6d,00,64,00,20,00,2f,00,6b,00,20,00,22,00,25,00,56,00,53,00,38,\
00,30,00,43,00,4f,00,4d,00,4e,00,54,00,4f,00,4f,00,4c,00,53,00,25,00,76,00,\
73,00,76,00,61,00,72,00,73,00,33,00,32,00,2e,00,62,00,61,00,74,00,22,00,00,\
00
 
[HKEY_CLASSES_ROOT\Drive\shell\whidbey cmd]
@="Whidbey Command Prompt Here"
 
[HKEY_CLASSES_ROOT\Drive\shell\whidbey cmd\command]
@=hex(2):63,00,6d,00,64,00,20,00,2f,00,6b,00,20,00,22,00,25,00,56,00,53,00,38,\
00,30,00,43,00,4f,00,4d,00,4e,00,54,00,4f,00,4f,00,4c,00,53,00,25,00,76,00,\
73,00,76,00,61,00,72,00,73,00,33,00,32,00,2e,00,62,00,61,00,74,00,22,00,00,\
00

GeneralRe: whidbey versionmemberflipdoubt27 Jun '05 - 2:24 
Thanks! How many people here are using Whidbey? Just an informal poll.
QuestionRe: whidbey versionmemberengfelt27 Mar '06 - 2:46 
Thanks alot. Really nice to have this Smile | :) Big Grin | :-D
 
Is it safe to just change Whidbey to VS2005 or is it included in the hex values as well?
AnswerRe: whidbey versionmemberandy_p27 Mar '06 - 3:40 
it works as-is for vs2005, but you could change the words on the context menu if you like. The hex is actually the unicode for
"cmd /k "%VS80COMNTOOLS%vsvars32.bat"
which uses the VS80 environment variables.

GeneralNice onememberdbvaughan29 Mar '05 - 14:14 
Thanks, very useful.
GeneralNice and 2002 ..memberhotind12 Nov '03 - 20:34 
Nice one.
 
But as you pointed, it didn't work for 2002. As 2002 sets then ENV variable as 'VSCOMNTOOLS'.
 
Thanks
GeneralGood Stuffmemberfbougadou28 Aug '03 - 5:16 
A handy tool to have. Nice work.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 23 Aug 2003
Article Copyright 2003 by flipdoubt
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid