powershell - 具有Powershell问题的ConvertTo-HTML

标签 powershell

我正在尝试使用PowerShell将在文本框中输入的值输出到HTML,但是有点卡住。这是我的代码:

$button1 = New-Object System.Windows.Forms.Button
$button1.Name = "button1"
$button1.Location = New-Object System.Drawing.Point(16, 350)
$button1.Text = "Create"
$button1.add_Click({ConvertTo-HTML -title "Email Signature" -body "<p>$textBox2.Text</p>"})

产生的HTML是...
System.Windows.Forms.TextBox, Text: Chris.Text

如何使输出简单地为“Chris”?

最佳答案

解决了:)

答案是:$($ textBox2.Text)

关于powershell - 具有Powershell问题的ConvertTo-HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5214829/

相关文章:

powershell - Azure PowerShell 剪贴板的使用

powershell - 我可以在自定义DSC资源中的get,set,test方法之间共享变量吗?

powershell - 获取Azure VM的存储帐户

regex - 如何使用正则表达式分解 .csproj 文件中嵌入的 xcopy 语句?

powershell - 如何将参数传递给 jenkins 管道中的 powershell 脚本

powershell - TeamCity 与 npm - 错误 : ENOENT, 统计数据 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'

powershell - 使用 AWS Powershell 部署到 AWS elastic beanstalk

powershell - 如何在将两个哈希表与 Powershell 进行比较时选择特定的哈希表键和值?

powershell - 从 ADUser DistinguishedName 获取 CN 值

sql-server - 调用-Sqlcmd : A network-related or instance-specific error occurred while establishing a connection to SQL Server