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.

Next stupid question...

Ok, say I want to run Vim in the Windows (XP) command prompt. But, I want it to run the version from Program Files and not system32 each time I type 'vim'

Please note that I do not want to type C:\Prog Files\Vim.... each and every time...just 'vim'

So, I thought I could simply add it to the registry by adding a key to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths, but that only applies to the Run command.

Is there something similar to enable it to be run from cmd? I tried adding a shortcut to it and renamed to 'vim.exe' but cmd doesn't recognize shortcuts as valid exes.

share|improve this question

4 Answers 4

up vote 9 down vote accepted

Add its directory to your PATH.

  • Right click My Computer and select Properties
  • Navigate to the Advanced tab and click the Environment Variables button

    alt text

  • Select PATH and hit edit

    alt text

  • append a semicolon with the directory location of VIM's executable

    alt text

Take the version you don't want to use out of the System32 folder.

share|improve this answer
    
thanks! simple answer is always the best! –  espais Dec 15 '09 at 13:49

In most cases I put the folder I want to use in the systems PATH variable Right click "My Computer" then Properties > Advanced > Environment Variables > System Variables. Edit it, follow the syntax that is already there, and just append it to the end.

share|improve this answer

Or, if you need to keep both versions, make sure the path for the one you want is ahead of the path of the one you don't want. In the example above, c:\ruby\bin was at the head of the path variable, so anything in there will match first: c:\ruby\bin\vim.exe (not that you'd put it there!) would run before the one in Program Files.

share|improve this answer
    
yea, i don't care too much about the system wide one as its a single user system...i just renamed it –  espais Dec 15 '09 at 13:50

Not sure if the command path on the command prompt will be of any use to you here. you can add the path your exe file is kept in your default paths and remove the one that you don't want.

Not sure if this will work, but you can type PATH. you'll see the paths in your system in the next line. copy them here(right click, mark text, select text you want, left click.) paste to notepad. make the changes you want(as mentioned above). then on the command prompt type path and paste your edited content.

Let me know if this works.

Help from path command directly :
Displays or sets a search path for executable files.

PATH [[drive:]path[;...][;%PATH%]
PATH ;

Type PATH ; to clear all search-path settings and direct cmd.exe to search
only in the current directory.
Type PATH without parameters to display the current path.
Including %PATH% in the new path setting causes the old path to be
appended to the new setting.
share|improve this answer

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.