Arshbeer_Singh
Level 5

Run a batch file present in file table from custom action.

I am trying to run a command that enables protocols of the web service i have hosted. for this i had created a batch file and made an entry into file table.
Either i am making an entry in the wrong way or else i am using it in the wrong way
please help

The target for custom action is as follows

cmd.exe /c ""


enableProtocols is the name of the file column in file table
Labels (1)
0 Kudos
6 Replies
Evan_Border
Level 8

Arshbeer Singh wrote:
I am trying to run a command that enables protocols of the web service i have hosted. for this i had created a batch file and made an entry into file table.
Either i am making an entry in the wrong way or else i am using it in the wrong way
please help

The target for custom action is as follows

cmd.exe /c ""


enableProtocols is the name of the file column in file table


MSI expects the entry to look like [#enableProtocols] (or whatever the name is that is listed in the File column of the File table). Your use of angle brackets is something more often seen in InstallScript.

There are other important things to consider as well, such as making sure that you're not calling the custom action until after the file has actually been installed (sequence it after the InstallFiles action). Also be sure to call it in Deferred Mode.
0 Kudos
Arshbeer_Singh
Level 5

Thanks Evan!

I did everything as u said. I have set the deferred execution and now the target looks like
cmd.exe /c "[#enableProtocols]"

I have kept it after installfiles (infact just before installfinalize so that the web service is also hosted)in the sequence but still no luck!
There must be a basic thing I am missing but I am not able to figure out what it actually is
Please Help!


P.S : What the action does is enable the net.Tcp protocol on the web service I have installed and the batch file is working fine as if i run it explicitly it does the job required.
0 Kudos
Arshbeer_Singh
Level 5

Problem Solved!
Well I am embarresed to say that after following your instructions the reason it wasnt working was I had no mentioned the file extension in file table column!

But running a file this way creates the file in my installation directory. Is there a way to run the batch file without the file being copied in the install directory like kept in temperory memory or something?

Thanks once again 🙂
0 Kudos
rrinblue22
Level 9

You can probably try the "Support Files" view. The files in here aren't installed but are available during the install.
These can be accessed via SUPPORTDIR public property in immediate mode.
0 Kudos
Evan_Border
Level 8

rrinblue22 wrote:
You can probably try the "Support Files" view. The files in here aren't installed but are available during the install.
These can be accessed via SUPPORTDIR public property in immediate mode.


I agree, use the Support Files/Billboards view. Highlight Language Independent and add your custom action file. Then update your custom action to look something like this: cmd.exe /c "[SUPPORTDIR]enableProtocols.cmd"

By using the Support Files\Billboards view, the file will only briefly exist under the %TEMP% folder (in a GUID subfolder) and will be automatically deleted at the end of the install.
0 Kudos
Arshbeer_Singh
Level 5

Mission Accomplished people! Loads of thanks!
0 Kudos