5

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 \\192.168.1.1\c$
> cd x:\
> vim .\test.txt
'\\192.168.1.1\c$'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.

3 Answers 3

3

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.

2

I don't think the problem is vim. Read this.

2
  • I think you are right. I included the details about vim and powershell because I am looking for a way to edit the file in vim without leaving powershell. For example, I am able to use the 'Edit with Vim' context menu item from the windows explorer to edit files on a UNC path. That is not an ideal work around since it requires me to leave powershell. Jul 15, 2010 at 16:39
  • You also might find this interesting if you haven't read it yet. serverfault.com/questions/36991/…
    – John
    Jul 15, 2010 at 17:38
1

You can make a simple add/edit in the registry:

  1. Go to HKCU\Software\Microsoft\Command Processor
  2. Create a new DWORD value called DisableUNCCheck
  3. Set the value to 1

After I did this I was able to use vim just fine without problems (probably will make it so my python/ruby stuff complains less too).

You must log in to answer this question.

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