views:

52

answers:

4

I have a little utility that I need to use, and I'm not sure where to have users save it in windows.

I want to know what is the Windows directory equivalent of /usr/bin ?

-mcpeterson

A: 

You can place the file here to make it accessible to any command/call

%windir%/system32

or you can place the file in a custom location and include it in the Windows 'path': http://www.computerhope.com/issues/ch000549.htm .

publicRavi
Is this a best practice for programs that are not related to windows itself?
mcpeterson
I disagree. Applications normally should go to `C:\Program Files` ( `%ProgramFiles%`) or to `C:\Program Files (x86)` (`%ProgramFiles(x86)%`) for 32-bit applications on a 64-bit version of Windows.
0xA3
@McPeterson Definitely not a best practice.
publicRavi
No non-Microsoft program should add files to the Windows directory. Except for drivers and stuff.
AndiDog
Windows equivalent of usr/bin = system32? Curious.
publicRavi
+1  A: 

Create a folder under the c:\program files\ folder and put it in there. If you want it to be runnable from the command line you'll need to add the folder path to the PATH environment variable.

TLiebe
Would the PATH variable need to be changed for this?
mcpeterson
You'll only need to add it to the PATH environment variable if you want the program to be runnable from the command prompt. If it's a Windows application you can just create a shortcut to it on the desktop.
TLiebe
+2  A: 

You should put it in a new folder in the "Program Files" directory. Then append that folder to the PATH variable (right-click "My computer" > Properties > Advanced > Environment Variables). As in *nix, the PATH variable defines which programs can be started without specifying the absolute path.

For example, I have all the gnuwin32 tools in "C:\Program Files\gnuwin32\bin" and added that folder to my PATH variable. Now I can directly use Unix tools like tar on Windows.

AndiDog
+1 for a clear answer with a nice example
mcpeterson
+2  A: 

Applications in Windows should be stored under the program files folder. This folder defaulta to

  • C:\Program Files (environment variable %ProgramFiles%)

or to

  • C:\Program Files (x86) (environment variable %ProgramFiles(x86)%) for 32-bit applications on a 64-bit version of Windows.

See also point 2.4 of the Windows Logo Requirements:

The application should install to the Program Files folder by default.

0xA3
Just to emphasize the need to use the environment variable when doing this programmatically, `c:\Program Files` is named differently in localized versions of Windows. In German, for example, it is named `C:\Programme`.
Pekka
Yes, one should either use the environment variable, Windows Installer properties or the Windows API functions to retrieve the location of the program files folder.
0xA3