首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Add-Type:未找到命令

Add-Type:未找到命令
EN

Stack Overflow用户
提问于 2020-12-25 16:33:23
回答 1查看 76关注 0票数 0

我正在尝试为PowerShell创建一个基本的图形用户界面,但是由于某些原因,它不能识别Add-Type参数。这是我使用的代码:

代码语言:javascript
复制
# 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

这里会有什么问题呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-26 02:19:20

add-type命令在我的5.1.18362.628版本中工作得很好

要查找您的PowerShell版本,请键入以下命令:

代码语言:javascript
复制
$PSVersionTable
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65446535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档