0
为什么如果我们使用“。\ script.ps1”调用的脚本启动$ host.version,并且如果我们执行命令un shell ?
从外壳:
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
[...]
感谢
谢谢TheIncorrigble1 :) 我想“脚本”是基于ISE主机? 如果我们想要轻松测试命令,最佳实践是什么? – GJE
所有主机的响应都是一样的,除非'$ Profile'中有东西可以改变环境@GJE 您可以使用'Get-Host'命令查看主机。 – TheIncorrigible1