Custom Action to delete folder using InstallShield
Answers (4)
Comments:
-
Thanks, it works. However it´s not that clear if there are any subfolders or not under the folder that I want to wipe. And if I understand things correctly I have to specify the exact folderstructure using RemoveFiles table? At least in my experiments with it so far. I´d like to remove *.* (files and folders) under the specified path. - Agathorn 9 years ago
Top Answer
to
Comments:
-
Thanks that worked out great! I had no idea of this! - Agathorn 9 years ago
Aaaaaaaaaaaaaaaaaaaah! Now it all comes out! :-) The RemoveFile table won't help you here, then, so it's back to script!
I suggest using an embedded script. That will allow you to access MSI properties (hint: the 'Session' object) in order to get the folder name, thus avoiding any problem with 32-bit/64-bit folder names.
One, add the 'force' argument to the DeleteFolder method. Two, remember that for embedded CAs, the script will be using Windows Installer's interpreter (let's call it that) and not Windows Scripting Host. Therefore, you won't be able to use the 'WScript' directive (e.g. in your WScript.CreateObject... line). Confusingly, you *will* be able to create WScript objects, e.g. WScript.Shell. To illustrate, this is valid in an embedded CA:
Set objWshShell = CreateObject("Wscript.Shell")
while this is not:
Set objWshShell = WScript.CreateObject("Wscript.Shell")
Hopefully, it follows that you can't then use things like WScript.Echo and WScript.Sleep in such CAs.
Script executed by calling CSCRIPT.EXe has no such restrictions but, conversely, can't natively "see" MSI properties. They would need to be passed to such a script, perhaps as command line argument(s).
Comments:
-
Yeah sorry for not asking the question more precise. I left out some information. Thanks for the explanation! Helpful information! - Agathorn 9 years ago
Comments:
-
The issue here is that we don´t really know the name of the subfolders as the application seems to create them differently on each computer after install. - Agathorn 9 years ago