cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
LukaszSte
Level 3

Custom Action CopyFile doesn't work

I attached an vbs script that does copying a file with name change.

Once the line with copyfile is present the setup completes with 'was intteruped error'.

If I remove that the script executes. What am I missing?

It's attached to after ready to install dialog event.

 


Dim sInstalldir

sInstalldir = Session.Property("INSTALLDIR")

MsgBox "BEFORE:" & sInstalldir

Dim pFs

Set pFs = CreateObject("Scripting.FileSystemObject")

Dim AppConfig

AppConfig = sInstalldir & "App.exe.config"


If pFs.FileExists(AppConfig) Then
pFs.CopyFile AppConfig , "C:\Program Files (x86)\APP\App.exe.bak" , True
End If

Please note that I tried MoveFile as well. The path is valid.

 

Labels (1)
0 Kudos
(3) Replies
varul
Revenera Moderator Revenera Moderator
Revenera Moderator

Is your script working properly outside of installer?

If the script is working then try to sequence the customaction after file transfer or after register product.
0 Kudos

The script works and this seems to be related with permission. I didn't have to force run as admin on calling the msi.

After adding this script this seems required...

 

Another thing. Can you send up-to-date link on how to access installdir on after file transfer event?

Many links in help navigate to some help which is removed from your help base. Like comments here:

https://community.flexera.com/t5/InstallShield-Forum/How-get-INSTALLDIR-in-custom-action/td-p/24481

 

 

0 Kudos
varul
Revenera Moderator Revenera Moderator
Revenera Moderator

Great!, Its expected that windows Installer Properties wont be accessible in after file transfer, Refer the attachment,

I have also created a sample project with custoamction sequenced after setup type dialog and its shows the installdir and copy file successfully, Please try the attached sample.

0 Kudos