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.

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
add comment

4 Answers

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
add comment

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
add comment

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
add comment

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

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.