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.

Is it possible to add a single program among many in a directory to the PATH environmental variable?

Say I have a bunch of programs in D:\utils. Rather than adding D:\utils\ to PATH I want to add D:\utils\utility-5.exe. This doesn't work though.

Is there a way to add it alone, or do I need to move it into its own directory?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

You will have to put it into a directory.

All the entries in your PATH variable must be directories to be useful. cmd.exe and any other shell or application that uses PATH will try to find the executable corresponding to any command you type by pasting the name of command onto the end of each PATH directory in turn until it either finds the command you asked for or it runs out of directories in your PATH. Any entry that doesn't exist or isn't really a directory will never match anything.

share|improve this answer
add comment

You can't add a single executable to the path. There may be an alternative to moving it to another directory, though - assuming it's on an NTFS partition, you could create a symlink to the executable in a directory that is in the path using the mklink command.

share|improve this answer
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.