我正在尝试为PowerShell创建一个基本的图形用户界面,但是由于某些原因,它不能识别Add-Type参数。这是我使用的代码:
# Init PowerShell Gui
Add-Type -AssemblyName System.Windows.Forms
# Create a new form
$LocalPrinterForm = New-Object system.Windows.Forms.Form
# Define the size, title and background color
$LocalPrinterForm.ClientSize = '500,300'
$LocalPrinterForm.text = "LazyAdmin - PowerShell GUI Example"
$LocalPrinterForm.BackColor = "#ffffff"
# Display the form
[void]$LocalPrinterForm.ShowDialog()使用以下命令运行时:$ ./exampleScript.ps1
我明白了:./exampleScript.ps1: line 2: Add-Type: command not found
这里会有什么问题呢?
发布于 2020-12-26 02:19:20
add-type命令在我的5.1.18362.628版本中工作得很好
要查找您的PowerShell版本,请键入以下命令:
$PSVersionTablehttps://stackoverflow.com/questions/65446535
复制相似问题