Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Why is there no /usr/bin in Windows?

Writer Andrew Henderson

I am a Linux user spending some time in Windows and I am trying to understand some of the Windows paradigms instead of fighting them. I notice that each program installed in the traditional manner adds the executables to

C:\Program Files

and then adds a shortcut to the Desktop / Start Menu containing the entire path. However, there is no common directory with links to the software, i.e.C:\bin\bar.exe which would link to

C:\Program Files\foo\bar.exe

Therefore, after installing an application the only way to use the application is via the menus or by navigating to the executable in the filesystem. One cannot simply Win-R to open the run dialogue and then type bar or bar.exeas is possible with notepad or mspaint. I realize that Windows 8 improves on this with the otherwise horrendous Start Screen which does support typing the name of the app, but again this depends on the app having registered itself for such.

Would I be doing any harm by adding C:\Program Files recursively to the Windows path? I do realize that there will be name collisions (i.e. uninstall.exe) but could there be other issues?

7

2 Answers

Usually there should not be any issues. However, you need to watch out for two things:

  • Avoid name collisions. In particular, make sure the standard path components (like C:\windows etc.) come first, so no system utility is hidden in the path.
  • The PATH variable may not contain more than 8191 characters. So if you have many program folders that you want to add, you may have to pick and choose. If you assume an average path length of 50 characters per program, that gives you space for about 160 programs in the PATH.

The reason this is not done by default is probably simply that the command line is used relatively rarely on Windows, so there was never a pressing need to have everything in the path. Most programs that need to invoke other programs have adapted to this, and use the full path for invocations.

Finally, if you would like to work on the command line a lot, like on Linux, I recommend you install Cygwin. It provides a Linux-like environment on Windows, and lets you work on the command line. It also maintains its own PATH variable, which you can customize without impacting other Windows applications.

2

The answer to this depends on the type of program you are talking about. If you are talking about programs that use shared libraries (DLLs):

C:\Program Files

is the correct place for them. You cannot put the files for these programs into the same folder because they are likely to have name collisions. If you are talking about programs that use static libraries (no DLLs):

C:\ProgramData\Bin

is the correct place for them. This is akin to:

/usr/local/bin

on Linux. This directory is available via a folder variable:

ProgramData=C:\ProgramData

If you need to get programs with shared libraries onto your Path, you can symlink them:

mklink C:\ProgramData\Bin\alfa.exe "C:\Program Files\Alfa\alfa.exe"
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy