代码可以执行,但是保存成脚本后执行就报错,请问是什么原因
powershell吧
全部回复
仅看楼主
level 1
Sylvanashe 楼主
以下代码在ise中,或是复制到powershell中,皆可正常执行:
Add-Type -AssemblyName PresentationCore,PresentationFramework,WindowsBase,System.Xaml;
class mywin : System.Windows.Window{};
[mywin]::new().ShowDialog() |Out-Null;
但是保存成ps1后,无论是右键使用powershell运行,还是在powershell中执行该ps1,都报错:
找不到类型 [System.Windows.Window]。
请问是什么原因
2023年02月09日 16点02分 1
level 1
最不折腾的办法是配置 $PROFILE 文件!
2023年12月16日 03点12分 2
1