topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 5:42 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: SOLVED: Open command prompt at current directory  (Read 26196 times)

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,747
    • View Profile
    • Read more about this member.
    • Donate to Member
SOLVED: Open command prompt at current directory
« on: June 16, 2010, 01:39 PM »
I've been playing around with Mercurial and the GUI provided by TortoiseHg and I've decided I don't like TortoiseHg that much. But I also don't like leaving the command prompt open all the time just for an occasional repository action. And I also don't like Win+R -> cmd -> [series of commands that navigate to the repo directory].

What I'd really like is some easy way to open a directory I'm in (from Windows Explorer) in the command prompt. Whether it's a shell extension so right click -> "Open dir in cmd" or if it's in the SendTo -> Cmd or even I guess a hotkey (though I'd rather not run a little hotkey app the whole time just for this one little use case scenario).

I thought I saw something like this already on DC but I can't find it. So if it already exists, please help point me to it. If not, please someone take up the cause and code it! :)

EDIT: Krishean made it super easy! (click the blue text below to quickly get to the download)

I took the liberty of compiling everything listed in the thread into one reg file (and one to reverse the changes)

features:
works on windows 7 (should work the same on both x86 and x64) dunno if it does anything on xp, may or may not work on vista
works with rightclicking on a blank area of the directory
works with rightclicking on a drive or directory
shift+rightclicking adds the additional option of "Open administrator command window here"
« Last Edit: November 12, 2017, 04:44 PM by Deozaan »

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: IDEA: Open command prompt at current directory
« Reply #1 on: June 16, 2010, 02:22 PM »
Google

Open Command Prompt Here

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: IDEA: Open command prompt at current directory
« Reply #2 on: June 16, 2010, 02:51 PM »
It's one of the features built into Listary, even the free-for-personal-use version.  But, it's another app to run and another hotkey, though you might like Listary's other features enough to run it anyway.  However, I suspect you're thinking of DOSHERE, mentioned in e.g. Feature Request - right click on results Command prompt here option.  As it's so small (just an INF file - don't ask me how to use it) I'll attach it to this post.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA: Open command prompt at current directory
« Reply #3 on: June 16, 2010, 04:56 PM »
http://www.favessoft.com/PromptHere.zip

It uses a hotkey rather than a context menu.  Should work on both 32 and 64 bit Windows.  At least it works for me in Vista64 and W7 32 bit.

edit: one thing different than most "command prompt here" type utilities is you can open more than one prompt.  Say you have \temp and \temp2 under C:.  Highlight them both and hit the hotkey.
You'll have a prompt for each with that folder as the current directory.

edit2: there's no unicode support. I provide source in case some may wish to investigate how to add unicode support to the program.  It's done in ahk.
« Last Edit: June 16, 2010, 05:00 PM by MilesAhead »

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,747
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Open command prompt at current directory
« Reply #4 on: June 16, 2010, 05:27 PM »
Thanks for the help, everyone.

I found out from the comments in this blog (the blog itself wasn't very specific) that Windows 7 (and Vista) already has this built in by following these steps:

1. Select the directory so that it is highlighted
2. Hold Shift and Right Click the directory
3. Select Open Command Window Here

If you want it in XP, there's a Microsoft Windows XP PowerToy for that. (Direct Link to EXE)

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #5 on: June 16, 2010, 05:57 PM »
In XP I used to add it to the context menu just a registry entry.

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #6 on: June 16, 2010, 08:34 PM »
Thanks for the help, everyone.

I found out from the comments in this blog (the blog itself wasn't very specific) that Windows 7 (and Vista) already has this built in by following these steps:

1. Select the directory so that it is highlighted
2. Hold Shift and Right Click the directory
3. Select Open Command Window Here

I wasn't paying attention (still running XP), but one of the links I checked said something about a registry entry that would show "Open Command Window Here" even when the Shift key wasn't being held down.  If that's of any interest...

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,747
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #7 on: June 17, 2010, 01:12 AM »
I wasn't paying attention (still running XP), but one of the links I checked said something about a registry entry that would show "Open Command Window Here" even when the Shift key wasn't being held down.  If that's of any interest...

That does interest me.

I found this one, which adds a "Run Command Prompt as Administrator Here":

[netshelter][HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Administrator Command Prompt here"
"NoWorkingDirectory"=""
 
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /k \"pushd %L && title Command Prompt\""
 
[HKEY_CLASSES_ROOT\Drive\shell\runas]
@="Administrator Command Prompt here"
"NoWorkingDirectory"=""
 
[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
@="cmd.exe /k \"pushd %L && title Command Prompt\""

Does anyone understand this stuff well enough to modify that so it doesn't use administrator privileges? I don't need the elevated privileges.

EDIT: I think I found the answer here, which basically says:

Rename or delete the "Extended" key for both "HKEY_CLASSES_ROOT\Drive\shell\cmd" and "HKEY_CLASSES_ROOT\Directory\shell\cmd" in the registry.

Just tested it and it works in Windows 7 (64-bit) though it should work both 32-bit and 64-bit versions (including Vista).

Thanks for pointing out this option, AndyM!
« Last Edit: June 17, 2010, 01:26 AM by Deozaan »

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: IDEA: Open command prompt at current directory
« Reply #8 on: June 17, 2010, 02:54 PM »
Windows 7 (and Vista) already has this built in by following these steps:

1. Select the directory so that it is highlighted
2. Hold Shift and Right Click the directory
3. Select Open Command Window Here

Just tried it, and it works on Vista Home Premium in a user account with UAC On.  But if you want a DOS prompt in the current directory, you'd have to go up a level then highlight the one you've just come from, because you don't get Open Command Window Here if you right-click on a file.

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #9 on: June 17, 2010, 03:42 PM »
Windows 7 (and Vista) already has this built in by following these steps:

1. Select the directory so that it is highlighted
2. Hold Shift and Right Click the directory
3. Select Open Command Window Here

Just tried it, and it works on Vista Home Premium in a user account with UAC On.  But if you want a DOS prompt in the current directory, you'd have to go up a level then highlight the one you've just come from, because you don't get Open Command Window Here if you right-click on a file.

You can also Shift-Right Click on a blank space within the current folder

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,747
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #10 on: June 17, 2010, 03:46 PM »
Windows 7 (and Vista) already has this built in by following these steps:

1. Select the directory so that it is highlighted
2. Hold Shift and Right Click the directory
3. Select Open Command Window Here

Just tried it, and it works on Vista Home Premium in a user account with UAC On.  But if you want a DOS prompt in the current directory, you'd have to go up a level then highlight the one you've just come from, because you don't get Open Command Window Here if you right-click on a file.

You can also Shift-Right Click on a blank space within the current folder

Any idea what registry setting that's under so I can remove the "Shift" requirement for it?

EDIT: Found it!

Navigate to "HKEY_CLASSES_ROOT\Directory\Background\shell\cmd" and rename or delete the "Extended" key.
« Last Edit: June 17, 2010, 03:49 PM by Deozaan »

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #11 on: June 18, 2010, 11:50 AM »


Any idea what registry setting that's under so I can remove the "Shift" requirement for it?

EDIT: Found it!

Navigate to "HKEY_CLASSES_ROOT\Directory\Background\shell\cmd" and rename or delete the "Extended" key.

That gives me an idea to relegate a lot of context menu items I rarely need to that Shift key..wonder if it works in reverse.

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #12 on: June 18, 2010, 05:02 PM »
That gives me an idea to relegate a lot of context menu items I rarely need to that Shift key..wonder if it works in reverse.
You are hereby directed to research, experiment, and report back.  ;D

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #13 on: June 18, 2010, 05:39 PM »
This NirSoft utility might be useful for managing the context menu and extended context menu.  Haven't tried it yet myself though.

http://www.nirsoft.n...shell_menu_view.html


lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #14 on: June 19, 2010, 12:25 AM »
This NirSoft utility might be useful for managing the context menu and extended context menu.  Haven't tried it yet myself though.

http://www.nirsoft.n...shell_menu_view.html

+1 for this tool. been using it for some time. it was helpful in snuffing out the spam WMP installs in the context-menu for the media files.

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #15 on: June 19, 2010, 03:30 PM »
if you want a DOS prompt in the current directory, you'd have to go up a level then highlight the one you've just come from, because you don't get Open Command Window Here if you right-click on a file.

You can also Shift-Right Click on a blank space within the current folder

Yes, tried it, you're right.  Thanks!  :)

Krishean

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 75
  • I like pie
    • View Profile
    • Draconis Labs
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #16 on: June 20, 2010, 07:56 PM »
I took the liberty of compiling everything listed in the thread into one reg file (and one to reverse the changes)

features:
works on windows 7 (should work the same on both x86 and x64) dunno if it does anything on xp, may or may not work on vista
works with rightclicking on a blank area of the directory
works with rightclicking on a drive or directory
shift+rightclicking adds the additional option of "Open administrator command window here"
Any sufficiently advanced technology is indistinguishable from magic.

- Arthur C. Clarke

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,747
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #17 on: June 21, 2010, 01:17 AM »
I took the liberty of compiling everything listed in the thread into one reg file (and one to reverse the changes)

Awesome! Thanks! I'll update the original post to point to your download. :Thmbsup:

EDIT: Just tested both the reg and the "undo" and they work as advertised (Win7 64-bit). Thanks again!
« Last Edit: June 21, 2010, 01:24 AM by Deozaan »

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #18 on: July 12, 2011, 07:09 PM »
Thanks for the help, everyone.

I found out from the comments in this blog (the blog itself wasn't very specific) that Windows 7 (and Vista) already has this built in by following these steps:

1. Select the directory so that it is highlighted
2. Hold Shift and Right Click the directory
3. Select Open Command Window Here


That is handy  :up:  Learned something new today :D

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #19 on: July 12, 2011, 07:50 PM »
In XP I used to add it to the context menu just a registry entry.

PromptHere can be used on XP, Vista, and W7 both 32 and 64 bit. It doesn't use the Glass blur effect on XP.  The glass effect is optional.  Set UseGlass=0 in .ini file if you don't want it.  You can also hit the Mouse hotkey in a blank space in a folder to open the prompt in that folder.  No need to navigate up first.

Edit: I updated PromptHere so that it no longer uses a macro to get the path of the current folder. It gets the info directly from Windows:

https://www.donation....msg264038#msg264038

« Last Edit: October 05, 2011, 12:51 AM by MilesAhead »

Hacnstein

  • Supporting Member
  • Joined in 2012
  • **
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #20 on: April 06, 2012, 07:32 AM »
I like command bar explorer from
http://www.codeproje...-Prompt-Explorer-Bar
I am not sure if it is for any OS past XP.  The source is there in C, any one up to updating it?  or doing a rewrite?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: SOLVED: Open command prompt at current directory
« Reply #21 on: April 06, 2012, 06:36 PM »
btw I did see after playing around with the Windows Seven built in context menu function that you  can select multiple folders in the same explorer window, then Shift Right Click for "open command window here."  That function will open a prompt with each folder as current directory. I've started using that on W7 just to cut down on the number of hotkey apps I'm running.  Likewise using the mouse to click on New Folder in Explorer instead of running a hotkey.