【发布时间】:2017-09-14 13:11:41
【问题描述】:
如果我们从一个用 ".\script.ps1" 调用的脚本启动它并且如果我们在 shell 中执行命令,为什么 $host.version 的输出会不同?
从外壳:
PS C:\Users\user\Desktop> $PSVersiontable
Name Value
--- -----
PSVersion 5.1.14409.1005
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1005
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
来自脚本:
PS C:\Users\user\Desktop>.\check.ps1
System.Collections.Hashtable
Key : PSVersion
Value : 5.1.14409.1005
Name : PSVersion
Key : PSEdition
Value : Desktop
Name : PSEdition
Key : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name : PSCompatibleVersions
[...]
谢谢
【问题讨论】:
标签: shell powershell output