Windows – How to edit file on UNC path with vim from powershell


I got the following error trying to edit a file on a UNC path using vim. How do I resolve this?

> new-psdrive x filesystem \\\c$
> cd x:\
> vim .\test.txt
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.

Best Answer

If you launch vim with vim.bat, it launches cmd.exe and runs vim.exe from there. cmd.exe doesn't like UNC paths unless you disable the check like others have suggested. Powershell doesn't require you to disable this.

What you want to do is either always launch vim like:

   vim.exe .\test.text

Or else, get rid of vim.bat (usually created in C:\Windows\system32) and make sure vim.exe is in your $Path.