Call command line after installation in Wix
Solution 1
Ok, this example works...
<CustomAction Id ="echo_test"
Directory ="INSTALLLOCATION"
ExeCommand ='NOTEPAD.EXE echo_test.txt'
Execute ="immediate"
Return ="asyncNoWait"
/>
My test example with echo didn't worked for some reason. And bcdedit does not exist on WinXP, where I am testing now...
Solution 2
echo
is not an executable, it is the command of the command processor cmd.exe
. Change your ExeCommand
value to cmd.exe /c "echo hello >echo_test.txt"
.
Your echo_test.txt
would be in an arbitrary directory, you have to use absolute paths to get predictable results.
Solution 3
Hi there are lots of example available on net...
try these links
http://wix.sourceforge.net/manual-wix2/qtexec.htm
Execute Command Line In WiX Script?
WiX - CustomAction ExeCommand - Hide Console
Or try this example:
<CustomAction Id="SetQtExecCmd" Property="SetQtExec"
Value=""[PutPathOfThisFileHere]bcdedit.exe" /set {current} nx AlwaysOff" />
<CustomAction Id="SetQtExec" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="check" />
Alex Blokha
Updated on June 20, 2022Comments
-
Alex Blokha almost 2 years
I am using wix and want to call command line after installation.
How can I do this?
My command line is here "bcdedit.exe /set {current} nx AlwaysOff" // this makes dep off
Yes, I've read about custom actions, but I didn't see any example with command line.
P.S. bcdedit is usual exe in Win 7 and higher.
P.S. currently I have next script and it does not work:
Directory ="INSTALLLOCATION" ExeCommand ='echo hello> echo_test.txt' Execute ="immediate" Return ="asyncNoWait" />
-
Alex Blokha over 12 yearsit says: Error 2 The CustomAction/@BinaryKey attribute's value, ' ', is not a legal identifier. Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.). Every identifier must begin with either a letter or an underscore. Its because it is empty. Yes, Ive seen those links. And I didn't see any working example for command line, not for single exe.
-
vinay over 12 yearsyes that is because the BinaryKey was empty...i have updated my answer ...check it out
-
Alex Blokha over 12 yearsI've used your example, but for some reasons when I use it, my installation fails. I've found correct answere.
-
Alexey Ivanov over 12 yearsSo this code does work, doesn't it? If yes, you should accept it as the answer. And my answer explains why it didn't work with
echo
. -
Alex Blokha over 12 yearsThe first correct answer was from me. But I still need working example for command "bcdedit.exe /set {current} nx AlwaysOff>>log.txt"