Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are trying to distribute an application using WinRAR. In Windows 7 the application needs to go to Program Files (x86); in XP it needs to be extracted to Program Files. Is there a way to make WinRAR test the OS, make that distinction and extract the files to the correct place?

share|improve this question
up vote 7 down vote accepted

No, this is not what WinRAR is for. You can use a batchfile to do this, but if you are distributing an application, you should be using an installer. You can find a list of common installers here. You can also try using a WinRAR SFX package (you can set it to extract to Program Files).

WinRAR is just an archiver, and depends on WinRAR being installed on the target system. Even if you were to automate it, you would either need to have WinRAR in one of the user's PATH directories, or ensure that it is installed in the same location always (there are environment variables for Program Files called %PROGRAMFILES% and %PROGRAMFILES(X86)%).

Again, while this is possible, it's not a good idea - this relies on the end user having WinRAR installed in the first place. Consider using an installer as I mentioned before, or using a WinRAR SFX package (although I'm not sure if you can use environment variables).

share|improve this answer
FYI: environmental variables are system wide. Youcan use them virtually anywhere when referring to a path – Canadian Luke Jul 27 '11 at 15:32

WinRAR is designed to compress/extract files, not to be a software installation program. Use something like NSIS or InnoSetup. See also this question.

share|improve this answer
+1 to InnoSetup. My favorite. It's a wonder more people don't use it. – user606723 Jul 27 '11 at 16:14

I just looked at my copy of Winrar, and I do not think it is possible to make Winrar check for an OS and extract based on that (I had serious doubts even before I looked).

You may be able to do it in a batch file on your own, or using some other program that makes installers. You would be interested in the %ProgramFiles% or %ProgramFiles(x86)% variables. Using those would direct it to the proper program files you wish to use.

share|improve this answer

In short, no. Winrar is not an installer, and is not meant to do those types of things.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .