0

I want to install a program with a batch-file to the Program Files folder. Afterwards I want to copy a folder to the same folder. Here is an example:

SET SCRIPT_LOCATION=%~dp0
SET INSTALLATION_PATH=%PROGRAMFILES%\example program

"%SCRIPT_LOCATION%\example program\setup.exe"

Now additional files should be copied to the program folder:

xcopy "%SCRIPT_LOCATION%\additional_files" "%INSTALLATION_PATH%example program\additional_files" /E

The problem is, that the program supports only 32bit. That means the program will be installed under "C:\Program Files (x86)\example program" on a 64bit machine.

But when the copy is executed, the files will be installed under "C:\Program Files\example program\additional files". But the additional files should be installed to the same path as the program.

I know that the operating systems decides which path should be used when %PROGRAMFILES% is used. The OS checks if the program supports 64bit maschines or not.

I think a possible solution would be to ask for the machine type (32/64bit) and decide whether %PROGRAMFILES% or %PROGRAMFILES (x86)% should be used with an if-clause. Or is there a way to parse the path from the installation to a variable and use it later for the copy?

Are there any other nice ways to include environment variables for my problem?

3
  • Try %PROCESSOR_ARCHITECTURE%
    – nimsson
    Jul 22, 2014 at 11:30
  • Which operating systems are you targeting?
    – and31415
    Jul 23, 2014 at 14:43
  • The best would be xp up to win8 and 32bit/64bit machines. I want the highest compatibility.
    – TaXXoR
    Jul 24, 2014 at 6:12

0

You must log in to answer this question.

Browse other questions tagged .