I'm trying to configure the native Windows Vim/gVim and the Cygwin Vim/gVim to behave nicely together. To this end, I created symlinks, ~/.vimrc and C:\Users\<myusername>\_vimrc, that both point to a common vimrc file containing my actual shared Vim configuration. (I did a similar trick with another config file that is sourced by my vimrc.) (Note that $HOME is C:\Users\<myusername>, so the above links are in the same directory; I just wanted to emphasize that one is used by Cygwin while the other is used by the Windows-native Vim.) The .vimrc file was created using ln -s in Cygwin, while the _vimrc file was created using the mklink Windows command.

This worked fine until I moved the location of the actual vimrc file to which the links point. I faithfully corrected the Cygwin and Windows symlinks; now Cygwin gVim correctly finds the rc file, but Windows gives the following error:

First, A command-prompt window pops up with the following message:

C:\windows\system32\cmd.exe /c <symlink> ■p
The system cannot find the file specified.
shell returned 1
Hit any key to close this window...

When I hit a key, that window closes and a little gVim pop-up window appears with the following message, which I assume is the Vim command that causes the problem:


When I close this window, gVim starts correctly, with the correct settings from my vimrc file. This last part boggles my mind somewhat, because I think it means that the _vimrc symlink is actually configured correctly--but if that's the case, why am I still getting an error?

Now, some notes:

  • When I first moved the vimrc file, my "correction" to the Windows symlink was to make it point to the Cygwin symlink. The error messages shown were the same, but when gVim finally started it did not load the configuration from the vimrc file.
  • I tried deleting the Windows symlinks entirely; I also tried uninstalling and re-installing the native gVim. Neither of these changed the behavior.
  • I see there are a couple other questions about using a setup somewhat like this, but I don't see any describing a problem very similar to mine.
  • I had been getting this error for a month whenever I launched gVim in Winblows. I had already replaced my usual Cygwin symlinks with copies to get rid of it, including for ~/.vimrc. It continued to haunt me until I thought to search the file system for remaining symlinks... And that's when I realized that I had forgotten about ~/.gvimrc. Maybe that'll save somebody some time and frustration...
    – bambams
    May 11, 2015 at 19:59

3 Answers 3


Well, this was about the dumbest fix I've ever seen. Launching gVim from the command line and manually specifying -u C:\Users\<myusername>\_vimrc not only prevented the error messages from popping up that time, it has apparently fixed my setup so that no matter how I launch Vim I no longer see the error messages described in the question.


This is an old thread but posting just in case it helps:

Possibly related to the down-voted post above, I had similar issues in Windows 10 that I resolved by making sure that the Windows %HOME% environment variable pointed to a folder that contained a _vimrc file.

I documented my trials, travails, and hacked solution here: https://vi.stackexchange.com/questions/20076/windows-context-menu-open-with-vim-symlink-error/20098#20098.

Am now able to launch gvim.exe from a cmd shell or via Explorer Edit with Vim context menu.


I used to have the same problem here. Using the rapid environment editor I figure out that a variable HOME was set to c:/cygwin/home/%user% under Windows environment:

enter image description here

After I removed this variable from Windows environment, gvim run without the problem.

  • 3
    You removed your HOME variable? That should break quite a few Cygwin programs; in Linux it's generally assumed that you have a valid $HOME at all times. Dec 17, 2015 at 18:49
  • I removed the HOME variable from Windows, but not inside cygwin. Dec 18, 2015 at 19:20
  • My hint solve the following annoying problem when I tried to use context menu to open files. C:\windows\system32\cmd.exe /c <symlink> ■p The system cannot find the file specified. shell returned 1 Hit any key to close this window... I understand that this does not solve the original question and I understand the motivation of the negative vote. Thank you for the maintain this site useful. Dec 18, 2015 at 19:33

You must log in to answer this question.

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