Windows – How to open command window from documents library

librarieswindows 7

Normally in Windows Explorer, I can open a command window by shift right-clicking in the folder. I love this feature.

However sometimes this item is missing from the context menu. This is really frustrating. On investigation, it's precisely when window is labelled 'documents library'.

How can I fix this? Either so the 'open command window' items shows up in both cases, or to force all Windows Explorer windows to be of the first kind.

enter image description here

enter image description here

Best Answer

  • I located a solution here for adding the 'Open Command Window Here' option to the Context Menu for Library Folders.

    You just have to add a few registry keys:

    HKEY_CLASSES_ROOT\LibraryFolder\background\shell
    HKEY_CLASSES_ROOT\LibraryFolder\background\shell\cmd (set value to what you want to be displayed on the right click menu, e.g. "Open command window here"
    HKEY_CLASSES_ROOT\LibraryFolder\background\shell\cmd\command (set value to "cmd.exe /k")
    

    If you're not familiar with the registry editor, you can just copy the following text into Notepad, save it as whatever.reg, and double click it:

    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"
    

    I did it in a slightly different way, exactly copying the keys and values that appeared in the cmd key within the Directory/background folder. The result is a little different, as the command window is opened at the location you expect (the current folder), rather than "C:\Windows\System32" as with the above.

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\LibraryFolder\background\shell]
    
    [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\cmd]
    "Extended"=""
    "NoWorkingDirectory"=""
    @="@shell32.dll,-8506"
    
    [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\cmd\command]
    @="cmd.exe /s /k pushd \"%V\""
    

    To address the comment by @Zoredache, this ambiguity exists only when the folder you are viewing is the union of folders, as indicated when the header section of your folder has something like this.

    enter image description here

    In this case, the location that the Command Window opens to is whichever directory in your Library is set as the 'Default Save Location'. Other than that, it behaves as expected.