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