我想创建Wix安装程序以从Wix执行许多Powershell,并且所有PowerShell脚本都需要用户输入。 例如 Wix应用 Powershell脚本:sc1.ps1,sc2.ps1,sc3.ps1,sc4.ps1
所有此脚本都需要用户输入,例如密码,文件路径,ip地址...等
要通过Wix安装所有此脚本。并管理用户输入。
答案 0 :(得分:0)
同意罗伯特·科特曼。
我个人从未使用过Wix,也没有理由。但是,获取用户输入是PowerShell的介绍性内容,网络上以及PowerShell帮助文档中都有大量示例脚本。使用它开始。
Get-Help -Name Read-Host -examples
NAME
Read-Host
SYNOPSIS
Reads a line of input from the console.
Example 1: Save console input to a variable
PS C:\>$Age = Read-Host "Please enter your age"
This command displays the string "Please enter your age:" as a prompt. When a value is entered and the Enter key is pressed, the value is stored in
the $Age variable.
Example 2: Save console input as a secure string
PS C:\>$pwd_secure_string = Read-Host "Enter a Password" -AsSecureString
This command displays the string "Enter a Password:" as a prompt. As a value is being entered, asterisks (*) appear on the console in place of the
input. When the Enter key is pressed, the value is stored as a SecureString object in the $pwd_secure_string variable.
还有其他方法可以使用脚本参数来获取用户输入,而不是使用PowerShell来使用Read-Host或表单来获取用户输入,特别是使用Show-Command cmdlet的简单PowerShell GUI或使用WinForms或WPF的完整PowerShell应用程序。