Showing results for 
Show  only  | Search instead for 
Did you mean: 
Not applicable

Custom Action condition based on existance of file

How can I add a condtion for a Custom Action that checks if a certain file or folder exists. Like equivalent to:
if C:\test exists run this action.

By the way, I need to check for the existence of the folder at the very end of the installation so I can't do a System Search because although that folder may exist at the beginning of the Uninstall, it may not exist by the end of the install.

Labels (1)
0 Kudos
(3) Replies
Level 7

System search is the built-in support in Windows Installer to check for the existence of a file or folder. Since it won't meet your requirements, you will need to use a custom solution:

1. You can create a custom action whose sole purpose is to check for the existence of the file/folder and to set a property. Then use this property to condition your original custom action.

2. You can modify the logic of your original custom action so that it itself will do a check on the existence of the file/folder.

0 Kudos
Level 5

I dont know if posting on an old post will work, but i will try!

I have two custom actions that are throwing warnings ("The Custom Action in the InstallExecuteSequence table is run from an installed file. To run the custom action successfully, you may need to have a condition that checks if the source file is installed locally."

So the custom actions work fine, but i see where i could be setting a condition in the Custom action under "Install Exec Condition" i just have never quite gotten the hang on condiitons, though i have tried many times.

what would be the syntax to check if the file has already been installed? and to run the custom action if it has been installed?

thanks for any help!
0 Kudos
Level 7

To get more familiar with conditions, please read the following help topic:

Conditional Statement Syntax

An example of a condition that you can use to prevent your custom action from running during any maintenance operation is 'Not Installed'. Or if you wanted to only prevent the custom action from running during an uninstall, then you could use 'REMOVE="ALL".'
0 Kudos