5
5
5napdragon2020-12-17 18:18:46
Computer networks
5napdragon, 2020-12-17 18:18:46

How to get the current network via bat?

I am writing a program on one ancient platform, in which there is no support for such simple things as, for example, getting the current network.

Briefly what I need.
Through bat, get the Internet network to which the PC is connected.
And output it to a separate file.

Something like this:

ECHO Request current network
WRITE activenet.txt

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Johnny Gat, 2020-12-17
@5napdragon

Here is the request and writing to the file:
netsh interface show interface > net.txt
Request only the connected interface (but will only work in OS with the Russian interface language):

netsh interface show interface | find /i "Подключен" > net.txt

Getting only the name of the connected interface:
wmic.exe nic where "NetConnectionStatus=2" get NetConnectionID |more +1 > net.txt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question