Jump to content

How do I use the {Filecopy} when I am using both x86 and x64


Recommended Posts

Yes, need both the true and false at end.

Did you copy and paste it in to the Config Wizard or your config.js?

What does the install log file say?

Are you on a 32bit system or 64bit? Set it accordingly.

Yes, I copied it into the Config Wizard. The install log says it failed. I'm using a 32bit system. I don't understand why it's not working...

Link to comment
Share on other sites


@ jadtunrau

I had the same issue and made a workaround.

If you have to copy a file (for example 'password.bin') after installing a program you can make a batch file like this and call it for instance 'copy.cmd'

CMDOW @ /HID

IF EXIST "%programfiles(x86)%" GOTO :X64

xcopy ".\Password\*.*" "%programfiles%\Foldername" /Y /i
GOTO :END

:X64
xcopy ".\Password\*.*" "%programfiles(x86)%\Foldername" /Y /i

:END
EXIT

In the directory from where the program runs make a folder "Password" where you put 'password.bin' (or even more files)

If you run the script the file 'password.bin' will be copied in the right Program Files folder - 32 or 64 bit and you don't need to make 2 entries.

The only issue I had was that a .cmd file was not executed in WPI ,Example: cmds[pn]=['%root%\\install\\progs\\SOMEPROGRAMFOLDER\\copy.cmd'];

So I decided to make an exe from the cmd file (with winrar for example) and then everything went good.

So with the command : cmds[pn]=['%root%\\install\\progs\\SOMEPROGRAMFOLDER\\copy.exe']; everything went fine.

I use '%root%\\install\\etc but it can also be '%wpipath%\\install\\etc (depends where you program exe files are stored)

I hope this can help you a bit and is an answer to your question.

And maybe Kel can tell me why my batch files don't run but exe files will.

Kind Regards , DJPro

Edited by DJPro
Link to comment
Share on other sites

Post the log file results of the batch file you are trying to execute. I think I know what it may be.

Hi mritter,

Thx for replying, I just did an install from my network share and everything went fine.

At least the cmd file was executed (the log file was succesfull)

1 Items, 2 Commands

-----

vrijdag 11 juni 2010 23:28:11
Program: AutoIt v3
Uniek ID: AUTOITV3
Volgorde: 000211
Categorie: Personal Tools
vrijdag 11 juni 2010 23:28:17 - cmd1 Success (returned code 0): Z:\install\progs\AutoIt3\autoit-v3-setup.exe /S
vrijdag 11 juni 2010 23:28:18 - cmd2 Success (returned code 4): "cmd.exe" /C Z:\install\progs\AutoIt3\copy.cmd
vrijdag 11 juni 2010 23:28:18 - Finished installation.

-----

Number of failed installations: 0

Install process finished at: vrijdag 11 juni 2010 23:28:19

Although, the script was run but nothing has been copied, the script I use was:

CMDOW @ /HID

mkdir "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler"

xcopy "Improved Decompiler\*.*" "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler" /Y


EXIT

Strange thing is that when I make an exe file from my script the files are copied well. (files inside the map 'Improved Decompiler') example here.

Am I missing something, I would like to hear it.

Thx in advance, DJPro

Link to comment
Share on other sites

Awhile back I updated the code to use the correct 32/64bit cmd.exe and I think it is not quite right. I will do some testing and see what's up. Be expecting a beta copy from me via personnal message on here.

Link to comment
Share on other sites

I did a quick test with this .cmd file:


CMDOW @ /HID

IF EXIST "%programfiles(x86)%" GOTO :X64

xcopy "C:\WPI\ChangeLog.txt" "C:\" /Y /i
GOTO :END

:X64
xcopy "C:\WPI\wpi.xml" "C:\" /Y /i

:END
EXIT

This is my logfile snippet:


Saturday, June 12, 2010 6:48:36 PM
Program: Test Copy
Unique ID: TESTCOPY
Order: 900040
Category: Applications
Saturday, June 12, 2010 6:48:36 PM - cmd1 Success (returned code 0): "cmd.exe" /C "C:\WPI\Install\TestScript.cmd"
Saturday, June 12, 2010 6:48:37 PM - Finished installation.

My file is in quotes, yours is not. Add quotes and see what happens.

Also, try not using %systemdrive%, use C:\ just to check if variables are honored.

Edited by mritter
Link to comment
Share on other sites

Hello mritter,

I tested it with your script and indeed everything went fine.

First I used this script

CMDOW @ /HID

mkdir "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler"

xcopy "Improved Decompiler\*.*" "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler" /Y


EXIT

and nothing was copied to the 'Improved Decompiler' folder

Then I changed it to this script

CMDOW @ /HID

mkdir "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler"

xcopy "Z:\install\progs\AutoIt3\Improved Decompiler\*.*" "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler" /Y


EXIT

and the files were copied to the 'Improved Decompiler' folder (Z:\ drive is the network share)

The logfile gave me this

zondag 13 juni 2010 3:08:01
Program: AutoIt v3
Uniek ID: AUTOITV3
Volgorde: 000211
Categorie: Personal Tools
zondag 13 juni 2010 3:08:07 - cmd1 Success (returned code 0): Z:\install\progs\AutoIt3\autoit-v3-setup.exe /S
zondag 13 juni 2010 3:08:08 - cmd2 Success (returned code 0): "cmd.exe" /C Z:\install\progs\AutoIt3\copy.cmd
zondag 13 juni 2010 3:08:08 - Finished installation.

Before I got a returned code 4 and now it gave returned code 0

The only thing I see is that there are no quotes in logfile on cmd2 part

Z:\install\progs\AutoIt3\copy.cmd

While you have qoutes there

"C:\WPI\Install\TestScript.cmd"

I don't know if this is important or not, although everything was fine.

Only issue I see or think is that the mounted network drive has to be Z:\ if I use that variable

Thx again, DJPro

Link to comment
Share on other sites

Yeah, if you don't specify the full path it won't work. It will think you mean the current directory you are in, which would be WPI's folder, or C:\. In your case the quotes wouldn't really matter since there are no spaces in the path.

Link to comment
Share on other sites

Ok, with the help from all of you, I think I've got it working. I'm using DJPro's script:

CMDOW @ /HID
IF EXIST "%programfiles(x86)%" GOTO :X64
xcopy ".\password\*.*" "%programfiles%\foldername" /Y /i
GOTO :END
:X64
xcopy ".\password\*.*" "%programfiles(x86)%\foldername" /Y /i
:END
EXIT

What I can't seem to figure out is how to execute an installer using this same method. I have a 32bit and 64bit installer for Winrar, and the below commands within WPI don't work:

{JSCRIPT}=(if getBits()==32) "%wpipath%\Install\Compression\WinRarx32.exe" /s
{JSCRIPT}=(if getBits()==64) "%wpipath%\Install\Compression\WinRarx64.exe" /s

I would prefer to have a single check box for both, so I don't have two for each program I have in WPI. But since the JSCRIPT option doesnt seem to work, can I use the a cmd script to install? I've tried the following without success:

CMDOW @ /HID
IF EXIST "%programfiles(x86)%" GOTO :X64
".\WinRarx32.exe"
GOTO :END
:X64
".\WinRarx64.exe"
:END
EXIT

Link to comment
Share on other sites

@jadtunrau

I've tested it with mritter's example and it worked.

So with a single check box for both x86 and x64

Example for winrar installation:

In my config.js a have:

cmds[pn]=['{JSCRIPT}=if (getBits()==32) RunCmd(\'%root%\\Install\\Progs\\Winrar\\Winrar-x32-371nl.exe\'%comma%false%comma%true)','{JSCRIPT}=if (getBits()==64) RunCmd(\'%root%\\Install\\Progs\\Winrar\\Winrar-x64-390nl.exe\'%comma%false%comma%true)'];

For 32 bit operating system it installed 'Winrar-x32-371nl' and for 64 bit 'Winrar-x64-390nl'.

Only thing I noticed that there were 2 command lines in installer window ( command 1 = success , command 2 = succes)

Maybe this is normal, I think?

My logfile gave me this:

dinsdag 15 juni 2010 0:04:22
Program: Winrar 3.7.1
Uniek ID: WINRAR32
Volgorde: 000230
Categorie: Utilities
dinsdag 15 juni 2010 0:04:23 - cmd1 Success (returned code undefined): if (getBits()==32) RunCmd('Z:\Install\Progs\Winrar\Winrar-x32-371nl.exe',false,true)
dinsdag 15 juni 2010 0:04:32 - cmd2 Success (returned code 0): if (getBits()==64) RunCmd('Z:\Install\Progs\Winrar\Winrar-x64-390nl.exe',false,true)
dinsdag 15 juni 2010 0:04:33 - Finished installation.

(Installation on x64 system.)

Thanks for this code mritter !!!

Greetz, DJPro

Edited by DJPro
Link to comment
Share on other sites

Yes, there is an entry for every one you made. WPI can't differeniate that you are doing a 32/64bit test. So one will always fail, one will succeed.

Good to hear you got it all working.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...