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

cmd.exe starts in %userprofile% when I start it normally. When I start it from vim, it starts in %systemroot%\system32.

How can I change this so it starts in a folder of my choice (from vim)?

share|improve this question
Which version of vim? This is not the behaviour of the :shell command within vim version 7.2, which quite happily spawns the command interpreter in whatever directory vim is itself in at the time. – JdeBP Jul 1 '11 at 15:26
up vote 3 down vote accepted

Navigate to the key HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor and search for the String Autorun in the right window. If that string is not existing yet create it as a "String Value". Double-click it afterwards and add the new directory path in the following way:

CD /d %systemroot%\system32


It looks like cmd.exe isn't using %systemroot%\system32 as it's starting path when running from vim. %systemroot%\system32 is just where cmd.exe is located. The working directory is still the same as when starting cmd normally.

share|improve this answer
+1 even though you deleted it. – KCotreau Jul 1 '11 at 14:59
I deleted it because I answered the question I perceived and not the question that was asked. It seems like the answer still applies though. Sorry for the confusion. – Origami Robot Jul 1 '11 at 15:24

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.