在我的脚本结束时我使用'ie' | ForEach-Object {Remove-Variable $_ -Force}.它在PS 2(Windows 7)中工作正常,但PS 5(Windows 10)引发错误:
'ie' | ForEach-Object {Remove-Variable $_ -Force}
无法删除变量,即因为变量已经过优化且无法移除.尝试使用Remove-Variable cmdlet(不带任何别名),或者使用您正在使用的命令来删除变量.
怎样才能让它与PS 5搭配得更好; 或者我应该使用Remove-Variable 'ie' -Force?
Remove-Variable 'ie' -Force
com powershell
com ×1
powershell ×1