如何在导入网络配置文件时忽略接口名称?
以下批处理文件仅在端点具有与以下 2 个批处理文件所定义的相同的接口名称(Windows 接口名称通常为:本地连接、无线网络连接、以太网、Wi-Fi)时才有效。我现有的批处理文件如下:
对于局域网:
for /F "tokens=3 delims=: " %%H in ('sc query "dot3svc" ^| findstr " STATE"') do (
if /I "%%H" NEQ "RUNNING" (
sc start dot3svc
)
)
sc config dot3svc start= auto
netsh lan add profile filename=".\Local Area Connection.xml"
无线局域网
for /F "tokens=3 delims=: " %%H in ('sc query "WlanSvc" ^| findstr " STATE"') do (
if /I "%%H" NEQ "RUNNING" (
sc start WlanSvc
)
)
sc config WlanSvc start= auto
netsh wlan add profile filename=".\Wireless Network Connection-mywifiname.xml"