Powershell args充當占位符
阿新 • • 發佈:2018-01-10
put com conn color 結果 分享圖片 rgs mark alt
function test-conn
{
Test-Connection -Count 3 -ComputerName $args
#args充當占位符的作用,這個占位符必須以args命名,否則不能識別,會拋出異常
}
Set-Alias tc Test-Conn
tc localhost
結果
tc localhost Source Destination IPV4Address IPV6Address ------ ----------- ----------- ----------- 5CD60537FF localhost 127.0.0.1 ::1 5CD60537FF localhost 127.0.0.1 ::1 5CD60537FF localhost 127.0.0.1 ::1
請關註如下的微信公眾號,獲取更多IT資訊:
Powershell args充當占位符