cmd.exe customizing the "Open Command Prompt here" shell extension

19,477

You were pretty close to solution. For me the following command works:

cmd.exe /s /k "pushd ""%V"" & title %V"

EDIT: There are several places in registry supporting the "Command Prompt Here" shell extension. For this change to work consistently across all objects (directories, drives and special folders), you have to search the registry for all occurrences of cmd.exe /s /k pushd "%V" and replace them with the value above.

Share:
19,477

Related videos on Youtube

cemulate
Author by

cemulate

Updated on September 18, 2022

Comments

  • cemulate
    cemulate over 1 year

    Thought I would see if anyone had any pointers on the following situation. I've been customizing command prompt to my needs, and recently changed the prompt for my user. Instead of displaying the path in the prompt, I would like it to always be the window title.

    I put a new registry key at

    HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Command Processor/AutoRun
    

    with value

    title %cd% 
    

    This script runs any time command prompt starts. This works. Whenever I open a command prompt via shortcut, this acts properly.

    However, whenever I open a command prompt via right click -> Open Command Prompt Here this apparently doesn't execute. I tried looking at the shell command for open here located at

    HKEY_CLASSES_ROOT/Directory/shell/cmd/command
    

    which by default is set to:

    cmd.exe /s /k pushd "%V"
    

    I tried changing this to:

    cmd.exe /s /k "cd %1 & title %cd%"
    

    The "%1" was suggested at other places online for an open-here script, and If I understand correctly the & should execute both commands. However, it still does not work every time I open command prompt here. The working directory is indeed correct, the the window title is still "C:\Windows\System32"

    Any pointers?

    • cemulate
      cemulate about 12 years
      Doesn't appear to work either, unfortunately.
    • Paul
      Paul about 12 years
      Does it work if you hardcode a title? I am wondering if it is getting substituted wrong or just not executed at all.
    • cemulate
      cemulate about 12 years
      Aha, it appears as if it ISN'T getting executed at all
    • cemulate
      cemulate about 12 years
      Upon saving the key with a hardcoded path, killing explorer and restarting, it appears the command isn't executed. Open prompt here still works correctly, even though I essentially broke it. I have no idea where the real script could be
  • cemulate
    cemulate about 12 years
    Can you perhaps tell me exactly the address of this registry key? My key apparently isn't being executed at all, as I found out in the above comments. This command probably works, but it seems that wherever I'm putting this key, doesn't actually get executed.
  • sryaoperations
    sryaoperations about 12 years
    This is exactly the key you pointed out in your question. This works for standard directories. Maybe you are trying with a special folder like "Desktop"? You have to search registry for all occurrences of cmd.exe /s /k pushd "%V" and replace them.
  • cemulate
    cemulate about 12 years
    Aaaaah, Desktop was my test case; I figured it would be a normal directory. I'll try that, thanks!
  • cemulate
    cemulate about 12 years
    Searching all instances of the original command and replacing them by yours works in all cases. You might add that part to the actual answer if you want.
  • Jon
    Jon about 10 years
    Can you add more information on what exactly to do in this situation?