千家信息网

Powershell args充当占位符

发表于:2025-02-01 作者:千家信息网编辑
千家信息网最后更新 2025年02月01日,function test-conn{Test-Connection -Count 3 -ComputerName $args#args充当占位符的作用,这个占位符必须以args命名,否则不能识别,会
千家信息网最后更新 2025年02月01日Powershell args充当占位符
function test-conn{Test-Connection -Count 3 -ComputerName $args#args充当占位符的作用,这个占位符必须以args命名,否则不能识别,会抛出异常}Set-Alias tc Test-Conntc localhost
结果
tc localhostSource        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资讯:

0