Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
319 views
in Technique[技术] by (71.8m points)

installation - execute commands using wix installer

In my Product.wsx I called one bat file which is executed using power shell. Batch file is uninstalling one .exe(differet app) and coping few folders in C:emp folder.

In web may placess I read calling BAT file from WIX is not good or advisable. IS there any other way to do the same without calling the bat file

        <SetProperty Id="InvokeTestPS1"
                     Before="InvokeTestPS1"
                     Sequence="execute"
                     Value ="&quot;[POWERSHELLEXE]&quot; -Version 2.0 -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command &quot;&amp; '[APPLICATIONROOTDIRECTORY]UpgradeupgradeMentor3_5.bat' ; exit $$($Error.Count)&quot;" />
        <CustomAction Id="InvokeTestPS1"
                      BinaryKey="WixCA"
                      DllEntry="CAQuietExec64"
                      Execute="deferred"
                      Return="check"
              Impersonate="no" />
        <InstallExecuteSequence>
          <Custom Action="InvokeTestPS1" After="InstallFiles">
            <![CDATA[NOT Installed]]>
          </Custom>
question from:https://stackoverflow.com/questions/65949437/execute-commands-using-wix-installer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For the folders you are copying, if you know beforehand what each folder is named and you don't need to worry about unexpected subfolders, you can use a CopyFile per folder you want to copy. Place them directly under a Component. If there's more variability in what needs to be copied, you can write an immediate custom action that adds temporary rows to the MoveFile table based on the files/folders you discover you need to copy (and the sane to the Directory table as needed).

For the uninstaller, you could call it instead of either powershell or the .bat file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...