powershell - 显示消息框以使用 Powershell 脚本从中复制代码部分

标签 powershell popup powershell-2.0 nuget-package

我正在为 Nuget pacakge 构建 install.ps1 脚本,并希望在最后打开弹出消息并显示一些消息,我已经通过以下方式实现了。

[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[Windows.Forms.MessageBox]::Show("Test message ", "Test", [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Information)

它将打开弹出消息,如下图所示。

enter image description here

我想在这里放置一些配置代码,用户可以按照下图从框中复制

enter image description here

如果有人以前做过类似的弹出框,请推荐我!

最佳答案

您将无法自定义Windows.Forms.MessageBox来添加您想要的内容。为了完成您想要的操作,您需要创建一个自定义表单。执行此操作的一个简单方法是使用 Primal Forms Community Edition,可以在 here 找到该版本。 。您需要免费注册才能下载。有一个付费版本,所以不要将其与免费的 CE 版本混淆。该工具为您提供了类似 Visual Studio 的表单编辑器,您可以将控件拖放到表单中并保存 Powershell 脚本。您需要为“复制到文本到剪贴板”按钮创建一个事件处理程序。保存 PrimalForms CE 生成的代码后,您需要对其进行编辑以添加事件处理程序的代码。有关如何使用 Powershell 设置剪贴板的示例,请参阅 here .

PrimalForms Community Edition Screenshot

关于powershell - 显示消息框以使用 Powershell 脚本从中复制代码部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8653985/

相关文章:

powershell - Powershell 2.0文件外格式化的噩梦

powershell - 如何创建与格式表配合良好的 PowerShell 数据结构

PowerShell:如何从源目录中仅复制选定的文件?

iphone - 如何在 iPhone xcode 上检测 GPS 的开/关以及我们如何知道我们的应用程序不允许使用 GPS?

powershell-2.0 - 如何在 PowerShell 中获取没有文件名的文件路径?

sorting - 在哈希表数组上使用排序对象

powershell - 由于 Azure Key Vault 内部错误,具有 Bit-locker 的 Azure VM 现在无法解密?

powershell - Windows PowerShell 等效于 Linux `ls -l`

html 表格中的 Javascript 弹出窗口

javascript - 弹出窗口中的浮线图具有重叠的轴标签