Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have made a tool that adds some things to the context menu when right clicking a directory, inside the 'empty space' of a directory, or a drive. I have used this extensively in Windows XP, Vista, and 7, but now that I've upgraded to Windows 8 I'm having an issue with getting the directory that the command was launched from.

One of the things I add is "Command Prompt Here", and I have accomplished this with the following in an INF file:

HKCR,Directory\Background\Shell\CommandPromptHere\command,,,"""%SystemRoot%\System32\cmd.exe"" /c cmd /s /k ""VER && PUSHD ""%1"""""

This adds the following in a REG_EXPAND_SZ key:

"%SystemRoot%\System32\cmd.exe" /c cmd /s /k "VER && PUSHD "%1""

Since this wasn't working, (couldn't find cmd.exe), I tried replacing it with:

cmd /c cmd /s /k "VER && PUSHD "%1"

In the Windows 7, Vista and XP, "%1" gets expanded to the directory who's background was right-clicked. However, it's not working in Windows 8. Even trying to echo it back to the command line doesn't seem to be working.

I can get "%cd%" to expand when I use "ECHO %cd%", but I can't seem to use it to start the command prompt there ("PUSHD %cd%" isn't working).

Has something changed with the arguments in Windows 8? Is there some other reason it's not working? Is there another way to "Start a command prompt in the current directory" with a registry entry? Am I missing something?

The code is here: for further details or suggestions.

share|improve this question
Why don't you just Shift + Right Click to get "Command Window Here"? And the "" at the end of your second example looks a bit odd. – Feb 10 '13 at 10:36
1) I don't want to shift + right click 2) I use this to also add Git Bash prompt, PowerShell Prompts, and also launch them as administrators 3) I do other things to the cmd prompt like set window title, color text red for admin prompts, etc. The double quotes get rendered as single quotes in the registry key. – Ehryk Feb 10 '13 at 11:17
Yes but I would have expected to see something like (again, in the second example) "%SystemRoot%\System32\cmd.exe" /c cmd /s /k "VER && PUSHD ""%1""" – Feb 10 '13 at 11:43

Evidently, for whatever reason %1 isn't populated when using the /Background/ commands in Windows 8 as it is in Windows 7.

I got around it by using:

cmd /c cmd /s /k "VER && @cd "%%%CD%%%"

Any insight as to why this changed is very welcome.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.