Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.
share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

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.

share|improve this answer
add comment

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

share|improve this answer
    
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. –  Eric Weilnau Jul 15 '10 at 16:39
    
You also might find this interesting if you haven't read it yet. serverfault.com/questions/36991/… –  John Jul 15 '10 at 17:38
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

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.