Erro ao alternar a rede sem fio usando netsh

0

Estou tentando buscar dados de um arquivo .bat para a configuração de rede. mas recebo o erro:

object already exists.

@ECHO off
cls
:start
ECHO.
ECHO 1. Change Connection1 Static IP 
ECHO 2. Change Connection2 Static IP 
ECHO 3. Change Connection3 Static IP 
ECHO 4. Obtain an IP address automatically
ECHO 5. Exit
set choice=
set /p choice=Type the number to print text.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto con1
if '%choice%'=='2' goto con2
if '%choice%'=='3' goto con3
if '%choice%'=='4' goto autosearch
if '%choice%'=='5' goto end
ECHO "%choice%" is not valid, try again
ECHO.
goto start
:con1
ECHO Connecting Connection 1
netsh interface ip set address "Wireless Network Connection" static 10.35.1.214 255.255.0.0 10.35.1.6
goto end

:con2
ECHO Connecting Connection 2
netsh interface ip set address "Wireless Network Connection" static 10.35.1.221 255.255.0.0 10.35.1.6
goto end

:con3
ECHO Connecting Connection 3
netsh interface ip set address "Wireless Network Connection" static 10.35.1.234 255.255.0.0 10.35.1.6
goto end

:autosearch
ECHO obtaining auto IP
ipconfig /renew "Wireless Network Connection"
goto end

:bye
ECHO BYE
goto end

:end
    
por Dhiraj 22.11.2015 / 07:57

1 resposta

0

Antes de definir o endereço, você precisa

netsh interface ip delete address

na interface

    
por 22.11.2015 / 08:18