问题
I am building install.ps1 script for Nuget pacakge and would like to open popup message at the end with some message , i have already achieved by following.
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[Windows.Forms.MessageBox]::Show("Test message ", "Test", [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Information)
It will open popup message as per shown in below fig.

Instead of this i would like put some config code here that user can copy from box as per below fig

Please suggest me if anyone has done similar popup box before!
回答1:
You won't be able to customize Windows.Forms.MessageBox
to add what your looking for. In order to do what your looking for you'll need to create a custom form. An easy way of doing this is to use Primal Forms Community Edition which can be found here. You'll need to register for free to reach the download. There's a paid for version to so don't confuse that with the free CE edition. This tool gives you a Visual Studio like forms editor where you can drag and drop controls to a form and save the Powershell script. You'll need to create an event handler for the copy to text to clipboard button. After you saved the code generated by PrimalForms CE you will need to edit it to add the code for the event handlers. An example of how you can set the clip board with Powershell can be found here.

回答2:
Users can copy the message box text simply by pressing the Ctrl+C key combination.
来源:https://stackoverflow.com/questions/8653985/display-message-box-to-copy-code-section-from-it-using-powershell-script