locked
cmd here in windows 7? RRS feed

  • Question

  • Hi. In Win Xp I found very usefull the power toy CmdHere to open a command window in the current folder. Is there something like this for Windows 7?

    Thanks
    Thursday, October 1, 2009 9:36 PM

Answers

  • Hold the Shift key down while right-clicking.  You should see an entry "Open Command Window Here" appear.

    For what it's worth, though I don't use that particular function, there are some I'd love to see capable of being added to a non-Shift right-click menu.  It's too bad there's no way to do that.

    -Noel
    • Marked as answer by Novak Wu Monday, October 5, 2009 2:25 AM
    Friday, October 2, 2009 4:53 AM
  • Are you right-clicking on a folder, and holding the shift key down before you click?

    This is what you're looking for:



    -Noel
    • Marked as answer by Novak Wu Monday, October 5, 2009 2:25 AM
    Saturday, October 3, 2009 6:24 PM

All replies

  • Hold the Shift key down while right-clicking.  You should see an entry "Open Command Window Here" appear.

    For what it's worth, though I don't use that particular function, there are some I'd love to see capable of being added to a non-Shift right-click menu.  It's too bad there's no way to do that.

    -Noel
    • Marked as answer by Novak Wu Monday, October 5, 2009 2:25 AM
    Friday, October 2, 2009 4:53 AM
  • In addition, i've just checked the rt-click feature and there are a few places where it does not work. The 'Open Command line here' feature will not open within a folder that is in a library....

    For example:

    Open explorer (default location = Libraries), shift+rt-click, the 'OCLH' is present
    Open a folder within the library, pictures for example, shift+rt-click and no 'OCLH'

    I think it's specific to files/folders that are not networked as such...

    Just thought i'd give a bit more info ;)
    Friday, October 2, 2009 8:34 AM
  • Thanks, but I can't see the option nowhere (not even in Libraries) (?????)
    Saturday, October 3, 2009 6:01 PM
  • Are you right-clicking on a folder, and holding the shift key down before you click?

    This is what you're looking for:



    -Noel
    • Marked as answer by Novak Wu Monday, October 5, 2009 2:25 AM
    Saturday, October 3, 2009 6:24 PM
  • @Orbital Shark -

    It took me a while, but I was finally able to reproduce what you're experiencing.

    I believe that what you're seeing is due to the fact that libraries are made up of 2 physical folders - C:\Users\Public\library and C:\Users\username\library.  Because of that, if you do not have a folder selected inside a library, there is no way for Windows to know which folder you want to open the command window in.  If you select any folder, and then shift+right-click, I believe you'll see the "Open command window here" option as expected.


    Ralph Bley
    • Proposed as answer by marcus1111 Sunday, December 29, 2013 2:32 AM
    Monday, October 5, 2009 6:32 PM
  • Ah, cool, thanks :)
    If anyone is helpfull, please click the 'Vote as helpfull' icon. If anyone has answered, please click 'Suggest as answer' at the bottom of the post involved :) Thanks
    Monday, October 5, 2009 7:22 PM
  • It worked. Thanks.
    Monday, October 5, 2009 7:51 PM

  • Good.  Now, how do you Open Command Window Here As Administrator?



    Here's a couple of sites with the Reg hack to open the Command Prompt as Administrator :

    http://www.burgaud.com/open-command-window-here/

    http://www.walkernews.net/2007/05/21/open-command-prompt-here-with-elevated-privilege/


    I modified their instructions a little.  Basically, they refer to the same three HKCR Reg keys as in the post above.  Each of those contains a shell subkey, which in turn contains one named cmd which contains a final one named command.   The trick is to create a new subkey named runas at the same level as shell\cmd.  That is, create shell\runas.  Then copy the (default) REGSZ info from shell\cmd and paste it into the new (default) REGSZ value of shell\runas.  (In my Vista system, it is @shell32.dll,-8506).  That provides the context-menu string "Open Command Window Here".  Next, add the subkey shell\runas\command.  Copy the info from shell\cmd\command (default) REGSZ and paste it into the new (default) REGSZ value of shell\runas\command.  (In my vista system, it is cmd.exe /s /k pushd "%V").

    Can anybody explain how the current-directory is being furnished into the %V variable?

    This results in a Context Menu entry  Open Command Window Here  with a UAC icon.  You get a UAC nag whenever you use it.  I actually have a Task already set up that elevates Command Prompt to Administrator directly without prompting.  I use a shortcut to trigger that task.  But it is hard-coded to my user-profile folder, so it cannot dynamically open in the current-directory.  I would like it to.  I'm not sure how to widget the task into this Context-Menu scheme, to bypass this annoying UAC nag.  I'll monkey with it, and if I figure it out, I'll post it.




    Now I'm just sure you wanted to delete this one before, Carey.  But now that you're deleting my posts en-mass (as you put it), here's one you missed!


    Come and get it !!!


    Monday, November 23, 2009 7:28 AM
  • Hold the Shift key down while right-clicking.  You should see an entry "Open Command Window Here" appear.

    For what it's worth, though I don't use that particular function, there are some I'd love to see capable of being added to a non-Shift right-click menu.  It's too bad there's no way to do that.

    -Noel


    Reg hack:   http://4win7.com/2009/05/enable-open-command-window-here-option-in-context-menu-in-windows-7.html


    Instead of permanently deleting those Extended keys, I renamed them  -Extended  (minusExtended).   That works, and is easily searched and restored if you later change your mind.  Also, here's a useful MS article that explains how To configure the command prompt.  Experiment with the Default and Properties Layouts.




    Delete this one too, Carey!  Don't miss a single one !


    Monday, November 23, 2009 7:29 AM
  • I just tried this on Win7 HomePrem:

    1. I did a "Run as Admin" on CMD

    2. I did CD to C:\Users\polebridge\AppData\Roaming\Microsoft\Windows\SendTo

    3. i saw the .lnks to my SendTo items

    4. i started my TextPad editor on one of them.  This was only to get TextPad running and cognizant of the current directory.  Notepad  won't do the trick.  Perhaps some other program that will open or create files will work, but i had Textpad handy.

    5. In Textpad i did a alt-f open to open a new file.  TextPad opens a file selection menu in the *current directory*!  Whoo-hoo!  

    6. I'm not really interested in opening a file, i just want the file selection box.   i can right-click in the box and get the New-> folder,shortcut dropdown.

    7. i create a new shortcut to cmd.exe, name it CmdHere, with %cd% in the "Start in:" box.

    8. Hit "OK" and i'm home free.  Now i have a CmdHere in my SendTo selection.

    9.  Any downsides?

    10.  Why can't i just  be happy with shift-rightclick. ?

     

     

    Tuesday, September 13, 2011 3:27 AM
  • That is awesome!  I was also looking for the powertools version of cmdhere for Windows 7.
    Wednesday, September 28, 2011 5:40 PM
  • I believe that what you're seeing is due to the fact that libraries are made up of 2 physical folders - C:\Users\Public\library and C:\Users\username\library. Because of that, if you do not have a folder selected inside a library, there is no way for Windows to know which folder you want to open the command window in.

     

    I don't think that's how libraries work. As far as I can tell, they're just shortcuts to the contents of the real folders you choose to include in them. For instance, if you add the following registry keys, you can open a command window by right clicking the background of a library folder you're in (which I think is what Orbital Shark was really asking about):

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\cmd]
    @="Open command window here"

    [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\cmd\command]
    @="cmd.exe /k"

    Furthermore, if you click the address line while you're in a library folder, it'll display the real path of the current folder.

    Sunday, December 18, 2011 9:59 PM
  • Thanks Noel works great! 
    Monday, January 30, 2012 9:45 PM
  • If anyone is interested, I posted a simple guide on how to do this without needing the SHIFT key:

    http://www.amilkhanzada.com/2012/03/command-prompt-here-for-files-and.html


    My website

    Wednesday, March 14, 2012 2:15 AM
  • Thanks, it works!
    Wednesday, July 4, 2012 6:25 AM
  • Copy the script below to a text editor of your choice and save it as "cmdhere.reg"

    REGEDIT4
    
    [HKEY_CLASSES_ROOT\*\shell\cmdhere]
    @="Cmd&Here"
    
    [HKEY_CLASSES_ROOT\*\shell\cmdhere\command]
    @="cmd.exe /c start cmd.exe /k pushd \"%L\\..\""
    
    [HKEY_CLASSES_ROOT\Folder\shell\cmdhere]
    @="Cmd&Here"
    
    [HKEY_CLASSES_ROOT\Folder\shell\cmdhere\command]
    @="cmd.exe /c start cmd.exe /k pushd \"%L\""
    
    

    Now, run the "cmdhere.reg" script and re-open your windows explorer. It should appear a new entry in your context menu ("CmdHere"):
    Sunday, October 15, 2017 6:33 PM