# Using vim under windows 7 with cmd not able to save files

I installed gvim for windows the other day and I'm trying to figure out why vim doesn't work properly with cmd. I tried creating new files under vim (starting vim from inside cmd or executing it directly). It seems like the file has been created but I can't see it in the explorer tree. I can open it with vim again and see the text I've written, so I'm guessing the file exists. Notepad or other editors doesn't seem to find the file either, even when inserting the path in the "filename to open" field they give me "file not found" error. I also tried searching for it, checking attributes and found nothing.

Anyone knows of a fix? By the way this works with gvim.

-

## 1 Answer

when you start up vim, it will often (depending on your situation) load up in VIM's current directory. Do a :!dir<Enter> to see what directory it thinks you're in and if you see the file.

To change your current directory do a :cd c:\path\to\dir and then do a :w filename and you'll see that it should work correctly.

-
:!dir? Just use :pwd instead. –  Benoit Nov 22 '10 at 16:34
I'm already in C:\. I also tried saving it like :w C:\filename, or :w filename (normal way you save files) but it doesn't show up. Have you tried it on your machine ? –  Daniel Nov 22 '10 at 16:48
@Benoit, I suggest :!dir because that will also list his directory so he can see if the file is there or not. –  g19fanatic Nov 22 '10 at 16:57