Skip to main content
Source Link
cemulate
  • 1.2k
  • 4
  • 18
  • 23

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

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?