vscode解决“无法将“xxx”项识别为 cmdlet、函数、脚本文件或可运行程序的名称“

1,193 阅读1分钟
go : 无法将“go”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1
+ go run main.go
+ ~~
    + CategoryInfo          : ObjectNotFound: (go:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

终端输入命令如下

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")

再次运行项目就可以了