当我使用New-Item
cmdlet创建新文件并想要使用psedit
在PowerShell ISE中编辑它时,我收到以下异常:
Exception calling "Add" with "1" argument(s): "Object reference not set to an instance of an object."
At line:7 char:13
+ $psISE.CurrentPowerShellTab.Files.Add($_.FullName) > $nul ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NullReferenceException
代码:
New-Item readme.txt
psedit readme.txt
PsVersionTable:
Name Value
---- -----
PSVersion 5.0.10586.494
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.494
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
这是一个已知的Bug吗?任何解决方法?