繁体   English   中英

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

[英]Trying to run the multiple powershell scripts from wix installer

在这里我尝试了一些但它根本不起作用任何人都可以指导我如何从安装程序运行多个脚本

<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)

这并不总是发生,但错误消息非常清楚。 这里是自动换行的,所以更容易阅读:

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 错误消息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM