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 am really sorry if this question is stupid or something, but how can I make a program (say vim editor) so that I can call it from any directory, even though it is not directly installed in that directory?

I thought setting path would work and that's what the setting path is for, but it's not working. Say my vim.exe is downloaded on my desktop. Is there way for me to be able to just call "vim.exe" from my command prompt, not necessarily on desktop directory, and still open vim editor??

Thank you !

share|improve this question

migrated from stackoverflow.com Mar 23 '13 at 21:57

This question came from our site for professional and enthusiast programmers.

    
I doubt if it's possible. For example, how can the OS know if you want to run C:\Some Directory\vim.exe but not C:\Users\Test\Desktop\vim.exe? –  Pablo Lemurr Mar 23 '13 at 21:03
    
pls explain why path didn't work for you. if you have c:/foo/vim.exe, and you add c:/foo into path, you could under F:/bar simply type vim.exe, you can start vim. btw, I feel that this question doesn't belong to SO, maybe superuser? –  Kent Mar 23 '13 at 21:07
add comment

2 Answers

up vote 0 down vote accepted

If you are on windows, then Vim should not be on your desktop. You should use the installer from http://www.vim.org/download.php This will make a folder "C:\Program Files (x86)\Vim\vim73" where your vim.exe and gvim.exe will be. Put this in your path.

Rapid Environment Editor is also a great tool for editing your PATH and any other environment variables: http://www.rapidee.com/en/about

share|improve this answer
add comment

You're correct, it's about PATH. Windows will look for the file in all directories specified in PATH. You should add a path to vim's directory there (not path to the vim executable itself).

Remember that programs load environment variables only on startup, so for example if you open cmd and then change PATH it won't apply to that cmd window instantly, you'll have to reopen it. The same applies to explorer.exe.

Also keep in mind that PATH won't work with everything, for example context menu filetype handlers in registry will accept only full path to the executable (this is true since XP SP2).

share|improve this answer
    
Perhaps I misunderstand something -- but if you set the path while in a cmd window, it will immediately affect where cmd looks for programs. –  echristopherson Mar 24 '13 at 2:12
1  
@echristopherson If you set PATH inside that window, then yes, but the change will be work for that window only. If you make that change globally (systempropertiesadvanced.exe etc.), then what I wrote applies. There's also a tool called setx that will change variable globally. –  gronostaj Mar 24 '13 at 7:07
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.