2010/07/23
查詢 PowerShell 版本
PS C:\> Get-Host
Name : ConsoleHost
Version : 2.0
InstanceId : 9c0bcffb-f780-402f-b4ab-696e29a34f67
UI : System.Management.Automation.Internal.Host.InternalHostUserI
nterface
CurrentCulture : zh-TW
CurrentUICulture : zh-TW
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
PS C:\>
Name : ConsoleHost
Version : 2.0
InstanceId : 9c0bcffb-f780-402f-b4ab-696e29a34f67
UI : System.Management.Automation.Internal.Host.InternalHostUserI
nterface
CurrentCulture : zh-TW
CurrentUICulture : zh-TW
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
PS C:\>
2010/07/07
PowerShell Array
宣告:
Add Array:
Get Array:
Array Contains & Notcontains:
[array]$tmpary= @()
Add Array:
$tmpary+= "a"
$tmpary+= "b"
$tmpary+= "c"
Get Array:
if ($ary.Count -gt 0)
{
foreach ($element in $ary)
{
echo $element
}
}
Array Contains & Notcontains:
if ($tempary -contains "a")
{
echo "a exists."
}
if ($tempary -notcontains "d")
{
echo "d not exists."
}