- <# :
- @echo off
- powershell -NoProfile -ExecutionPolicy bypass "Get-Content -literal '%~f0' |Out-String|Invoke-Expression"
- pause
- #>
- $默认网关="192.168.2.1"
- $a=ipconfig /all
- $b=([regex]"以太网适配器 (.*?):[\s\S]+?默认网关.*?: (\d+\.\d+\.\d+\.\d+)").Matches($a)
- foreach($m in $b){if($m.Groups[2].Value -eq $默认网关){$m.Groups[1].Value}}
复制代码
|