vendredi 16 octobre 2020

batch file IF condition

I'm trying to get the current active connection with netsh (i'd rather not use wmic) using the following code.

@echo off

FOR /F "tokens=3,*" %%A IN ('netsh interface show interface^|findstr /i "\<connected\>"') DO (

if %%B == .........
)

I only want to account for the default connection names:

Wi-Fi, Ethernet, Wireless Network Connection, Local Area Connection and do something based on that.

eg: if %%B = WiFi or Ethernet or....(

::do something here )

I only want "something" to be executed once because only 1 of those connections will ever be active at any given time.

Aucun commentaire:

Enregistrer un commentaire