windows 尝试从wix安装程序运行多个powershell脚本

3pmvbmvn  于 2022-12-05  发布在  Windows
关注(0)|答案(1)|浏览(174)

在这里,我已经尝试了一些东西,但它不工作,在所有谁能指导我如何运行安装程序的多个脚本

<SetProperty Id="PS1"
         Before="PS1"
         Sequence="execute"
             Value ="&quot;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe&quot;-NoLogo -NonInteractive -ExecutionPolicy Bypass -InputFormat None -NoProfile -File &quot;-Command &quot;cd '[INSTALLLOCATION]'; &amp; '[#ps1]' ; exit $$($Error.Count)&quot;" />

<CustomAction Id="PS1" 
              BinaryKey="WixCA" 
              DllEntry="WixQuietExec" 
              Execute="deferred" 
              Return="check" 
              Impersonate="no" />
        
<InstallExecuteSequence>
    <Custom Action="PS1" After='InstallFiles'>
        <![CDATA[NOT Installed]]>
    </Custom>
</InstallExecuteSequence>

到目标文件夹文件被复制,但它说这样为什么我不知道,在一个日志文件中,它显示这样

WixQuietExec:  Processing -File '-Command cd' failed because the file does not have a '.ps1' extension. Specify a valid Windows PowerShell script file name, and then try again.
WixQuietExec:  Windows PowerShell
WixQuietExec:  Copyright (C) Microsoft Corporation. All rights reserved.
WixQuietExec:  
WixQuietExec:  Try the new cross-platform PowerShell https://aka.ms/pscore6
WixQuietExec:  
WixQuietExec:  Error 0xfffd0000: Command line returned an error.
WixQuietExec:  Error 0xfffd0000: QuietExec Failed
WixQuietExec:  Error 0xfffd0000: Failed in ExecCommon method
CustomAction PS1 returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
wpx232ag

wpx232ag1#

这种情况并不总是发生,但错误信息非常清楚。这里是自动换行的,因此更容易阅读:

WixQuietExec:  Processing -File '-Command cd' failed because 
               the file does not have a '.ps1' extension. 
               Specify a valid Windows PowerShell script file
               name, and then try again.

这是PowerShell错误消息。

相关问题