Answer the question
In order to leave comments, you need to log in
How to connect to the specified network through a bat file?
In a third-party program (written in ancient Roman), I get a list of available networks, through a third-party bat file.
What I need is for me to select the network to which I want to connect in my program and bat read it, for example, from the file connectnow.txt
Text: Ethernet
Then I connected to it,
and the same thing when disconnecting from the network.
disconnectnow.txt
Text:Ethernet
Help me out
Answer the question
In order to leave comments, you need to log in
Using the contents of a file in a command:
set /p ARGS= <connectnow.txt && netsh interface set interface "%ARGS%" enable
set /p ARGS= <disconnectnow.txt && netsh interface set interface "%ARGS%" disable
подключиться к сети
netsh interface set interface "Ethernet" enable
отключиться от сети
netsh interface set interface "Ethernet" disable
подключиться к сети
netsh interface set interface name="Ethernet" admin=ENABLED
отключиться от сети
netsh interface set interface name="Ethernet" admin=DISABLED
подключиться к сети
Enable-NetAdapter -InterfaceAlias "Ethernet"
отключиться от сети
Disable-NetAdapter -InterfaceAlias "Ethernet"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question