5

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)?

1
  • 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, 2011 at 15:26

1 Answer 1

3

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

Source

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.

2
  • +1 even though you deleted it.
    – KCotreau
    Jul 1, 2011 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. Jul 1, 2011 at 15:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .