How to run cmd.exe or other exe on user's machine from a setup project?

How to run cmd.exe or other exe on user's machine from a setup project?

Post by Bogda » Wed, 06 Jun 2007 03:43:31


I'm not sure if I got it right but according to the on-line docs Windows
installer allows you to run exe on user's machine (i.e. an exe that is not
included in a given setup project). I think that this is custom action type
50. I can't figure out how to add such exe to my setup project in VS. It
seems that I can only add files that are included in the project.

Any help will be appreciated.
Thanks,
Bogdan
 
 
 

How to run cmd.exe or other exe on user's machine from a setup project?

Post by Phil Wilso » Thu, 07 Jun 2007 05:32:13

That's correct - Visual Studio offers a subset of what's in MSI, and that
particular built-in custom action isn't available (run an existing exe on
the target system) but you can write your own custom action to run it.
--
Phil Wilson
[MVP Windows Installer]

 
 
 

How to run cmd.exe or other exe on user's machine from a setup project?

Post by Tony Leun » Thu, 21 Jun 2007 00:36:46

Thank you.
But how can we run an existing exe on the target system?
 
 
 

How to run cmd.exe or other exe on user's machine from a setup project?

Post by Bogda » Thu, 21 Jun 2007 22:18:24

As Phil suggested, you can create your own custom action (exe or dll) that
runs the existing exe. I use dll custom action because I need to interact
with msi. Exe custom action is somewhat easier because you do not need to
deal with msi at all and you can easily test it on its own. Your custom
action could be as simple as a single call to CreateProcess() or
ShellExecute().

Bogdan