How to move an existing file ? - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

jsapienza
Posts: 9
Joined: Wed Nov 21, 2007 6:10 pm

How to move an existing file ?

Im trying to do a package to replace iedkcs32.dll . I want to move the current version to a folder as backup. Im having trouble figuring out how to perform this task.

Thanks.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

There are two methods to do this:
1) you use a "File Copy/Move Operation" that will copy the file to the folder you want before it is rewritten. This operation looks like this:

Source File
Name: iedkcs32.dll
Folder: SystemFolder (you can select it using the "..." button)
Destination File
Name: iedkcs32.dll
Folder: FOLDER (the folder with the backup)
Properties
Component: application.exe (you will choose from the combo box a component that is always installed)
Operation: Copy

2) you use a custom action that will backup the file before it is rewritten. There is an example for this in the User-Guide, please take a look:
http://www.advancedinstaller.com/user-g ... le-ca.html

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jsapienza
Posts: 9
Joined: Wed Nov 21, 2007 6:10 pm

I have tried method 1 several times but it does not seem to put the file in the folder.I created a copy/move like this:

Image

Any ideas ?
Thanks !
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

Please send us the AIP (if it doesn't contain confidential information) or a small test case reproducing this behavior to support at advancedinstaller dot com so we can investigate the problem.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jsapienza
Posts: 9
Joined: Wed Nov 21, 2007 6:10 pm

email was sent .. thanks.
jsapienza
Posts: 9
Joined: Wed Nov 21, 2007 6:10 pm

I did more testing.. It seems to move file just fine in XP but not Vista.
This is ok for me since I am only using my app on XP boxes.

Now my issue seems to be that it is replacing my file before I can back it up. Any tips on how to correct this ?

Thanks !
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
I did more testing.. It seems to move file just fine in XP but not Vista.
This probably happens because you are trying to move the file from the "Windows\System" folder. You should set the "Operation" field to "Copy" instead of "Move" in the "Edit File Copy/Move" dialog.
Now my issue seems to be that it is replacing my file before I can back it up. Any tips on how to correct this ?
I cannot reproduce this behavior on my test machine.

I noticed that in the AIP you sent you are installing the "iedkcs32.dll" file in a sub-folder of APPDIR. Are you trying to rewrite the file in the "Windows\System" folder or in your application's folder?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jsapienza
Posts: 9
Joined: Wed Nov 21, 2007 6:10 pm

First off I want to thank you for your help on this. It's greatly appreciated.

I was trying to backup the current iedkcs32.dll to APPDIR\original then write a new iedkcs32.dll to \windows\system32 .
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

I have tested this scenario (with another file) and it works. Also, I cannot reproduce the behavior you mentioned (the file is always copied before it is rewritten).

Please make sure that you follow these steps:
- you add the new DLL in the "Windows Volume\Windows\System" folder in the "Files and Folders" page
- you right-click it, select "Properties", go to the "Version" tab and check the "Ensure that this file overwrites any installed target file" option
- in "Application Folder" you create a "File Copy/Move" operation like I explained in one of my previous posts (you set the "Operation" field to "Copy")
- when the installation runs, the DLL will be copied in the folder specified in the "Folder" field in the "Destination File" section (in the "Edit File Copy/Move" dialog) and the original (in the "System32" folder) will be overwritten.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jsapienza
Posts: 9
Joined: Wed Nov 21, 2007 6:10 pm

I followed your exact instructions and It seemed to work until I got this:
Image

It seems to not to want to overwrite a newer version. I am trying to overwrtie an newer dll with an old one due to a bug M$ will not fix.
I do have the checkbox set for the overwrite on the version tab.

Any way to get around this ?
Many Thanks!!
jsapienza
Posts: 9
Joined: Wed Nov 21, 2007 6:10 pm

Also, A manual copy and paste will overwrite the file as it should.
jsapienza
Posts: 9
Joined: Wed Nov 21, 2007 6:10 pm

I seem to have worked around this issue by doing a vbs ScriptInline to overwrite the file. I would still like to know if this is possible without scripting.
Thanks!
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

This happens because the "iedkcs32.dll" file is under the Windows File Protection system, therefore Windows Installer cannot overwrite it.

However, a custom action can overwrite this file because the file can be overwritten manually. Therefore, since you encountered this behavior, the only solution is to use a custom action.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jsapienza
Posts: 9
Joined: Wed Nov 21, 2007 6:10 pm

With some creative scripting I was able to work past the WFP error. Thanks for your help!!

Return to “Common Problems”