Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using windows 7.

Unix I can open a file in vi with by using:

vi textFile.txt

In windows I want to navigate to the folder and type what I have above.

What is the best way to go about this?

Thanks, Eric

share|improve this question
up vote 3 down vote accepted

Firstly vi isn't installed by default and is not available on windows. A very good emulation of vi is available called vim, I assume for the rest of this that you have vim installed.

What you want to do is launch vim.exe from the command line without specifying the full path to the file. To do that you need to add the full path to the file's containing folder to the PATH environment variable. Here's how to do that:

Go to computer in windows explorer. Then right click on the background and select properties This should bring you to the system folder of the control panel.

In the left hand pane click Advanced system settings, click the environment variables button at the bottom of the new window that pops up.

The top pane of this window should be titled User variables for <Your Username>. Scroll through this list of user variables, and find one named path (capitalisation not important) and edit it. If there isn't a path variable on the list, then click the new button under the list to create a new variable, and name it path.

If you're creating a new path variable, simply paste the path to the containing folder as the value of the user variable. if you're editing an existing path variable you need to add a semi-colon ; character immediately followed by the path to your vim installation. the path to your vim instalation proably looks something like this: C:\Program Files (x86)\Vim\vim74

Now you should be able to use vim similarly to how you would use vi.

share|improve this answer

On my system it works, the syntax is the same:

C:\>vim somefile.txt

Make sure vim is in your path. Make sure you select the console and GUI versions when installing (I think this is the default now).

share|improve this answer
What needs to be in my path for windows? Vim.exe? – eric f Aug 31 '12 at 12:20

During Vim (for Win32) install, you have the option to install batch files for launching vim from the command-line.

share|improve this answer

You must log in to answer this question.

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