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 have various console applications around the system which I use periodically. To run them I open a command line and navigate to the relevant folder to execute them.

Is there a way I can configure these to be run from any location (like nslookup/ipconfig etc)?

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

You can do so by adding their paths to the system path variable. In XP, Right-click on 'My Computer', choose properties, then the 'Advanced' tab. On the bottom of that is a button for Environment Variables. In the 'System Variables' section of the dialog you should find one labeled 'Path'. Add a semi-colon and then your path(s) to the end to make your programs work from anywhere via the commandline.

The process is nearly identical in Win7.

share|improve this answer
add comment

From http://commandwindows.com/runline.htm:

The Registry can be edited to explicitly contain the path to the desired executable file or files. The Registry key involved is HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths

  1. Create a new sub-key with the name of the executable file that you wish to add to the path. e .g., HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\somefile.exe
  2. In this new key, add a string variable named "Path" containing the value of the the path to your new executable file, e.g., C:\Program files\newprogramfolder\
  3. The new key will already have an empty variable (Default). Edit it to have the string value of entire address of the new program executable , e.g., C:\Program files\newprogramfolder\somefile.exe

You can now enter "somefile.exe" into the Run line to open the program.

share|improve this answer
add comment

While it's possible to add the path to each app to your environment variables, it's less cumbersome (and in the past, consumed far less of your system's resources - though I'm not sure that's a meaningful concern anymore) to just create a folder specifically to contain .bat files that reference the other commands you want easy access to.

Set up the folder, add that ONE location to your system path (as described above), then just create a .bat file (in that folder) pointing to each command-line item. The other benefit of this is that if you prefer to run any of them with flags or switches, you can stick it right in the .bat, save yourself a few keystrokes.

Might be 6 vs. 1/2 dozen, but it just seems cleaner to me.

share|improve this answer
    
that's an interesting idea.. may be good for invididual 3rd party apps that each go to their own directory and have more than just an exe and you don't want to or can't put the EXE in one directory with others. But for a situation like gnuwin32 which has a bunch of EXEs, you wouldn't want to write a bat file for each of them, so best thing there is to add the directory to the path. Anyhow, I think your idea is useful in some situations. I might try it..possibly! –  barlop Feb 11 '11 at 8:14
    
Thanks for the extra insight! –  Liath Feb 13 '11 at 20:23
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.