19

How can I execute a command line from within a WiX script?

I want to dynamically generate a command line string and have it executed. I'm not installing a file related to this.

Using version 3.0.5419.

1 Answer 1

29

What you probably want is something like this (observing quotes where necessary in the command):

<CustomAction Id='ExecNotepad' Directory='INSTALLDIR' Execute='immediate' 

ExeCommand='[SystemFolder]notepad.exe &quot;[SOMEFILE]&quot;' Return='ignore'/>

The ExeCommand is where you want to put your command. Here I have notepad launching with a file. Some of the attributes will be different, depending on what your command does - particularly the Execute and Impersonate parameters. It would also be helpful to know what version of WiX you were using (the code above is v2).

Sign up to request clarification or add additional context in comments.

3 Comments

Here's the page for the CustomAction element for v2: wix.sourceforge.net/manual-wix2/wix_xsd_customaction.htm and v3: wix.sourceforge.net/manual-wix3/wix_xsd_customaction.htm Hope that helps
I check the documentation of the V3, but I could not find what would be different with your example, did I miss something?
Edit: Ok, now I understand. There probably wouldn't be a difference in this sample, I just wanted to point to both versions of the documentation because some related stuff is different BTW, here is the WiX v3 documentation on the new site: firegiant.com/wix/tutorial/events-and-actions/extra-actions Note that this is not how I actually do this nowadays, because I want more control over how errors are handled. I have a WiX extension which creates entries in a custom table, and a custom action (part of the same extension) which processes the entries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.