Ich habe dies hier gebastelt :-)
@echo off
cls
:statdyn
echo Dynamische IP-Vergabe? ("ja" oder "nein")
set /p dyn=
if "%dyn%"=="ja" GOTO dynamic
:eingabe
cls
echo IP:
set /p ip=
cls
echo Maske:
set /p mask=
cls
echo Gateway:
set /p gw=
cls
echo DNS:
set /p dns=
cls
echo Sind Ihre Angaben korrekt? ("ja" oder "nein")
echo.
echo.
echo.
echo IP-Adresse: %ip%
echo Subnetzmaske: %mask%
echo Gateway: %gw%
echo DNS: %dns%
echo.
echo.
echo.
echo Antwort:
set /p ack=
if "%ack%"=="nein" GOTO eingabe
if "%gw%""=="" AND "%dns%=="" GOTO ohnegwdns
if "%gw%"=="" GOTO ohnegw
if "%dns%"=="" GOTO ohnedns
cls
echo Die Einstellungen werden vorgenommen... (alles)
netsh interface ip set address "LAN-Verbindung" static %ip% %mask% %gw% 1
netsh interface ip set dns "LAN-Verbindung" static %dns%
echo IP-Konfiguration:
ipconfig /all
pause
GOTO RESET
:dynamic
cls
echo Es wird versucht ein DHCP-Lease zu erhalten:
netsh interface ip set address name="LAN-Verbindung" source=dhcp
netsh interface ip set dns name="LAN-Verbindung" source=dhcp
echo IP-Konfiguration:
ipconfig /all
pause
GOTO RESET
:ohnedns
cls
echo Die Einstellungen werden vorgenommen... (ohnedns)
netsh interface ip set address "LAN-Verbindung" static %ip% %mask% %gw% 1
netsh interface ip delete dns "LAN-Verbindung" all
echo IP-Konfiguration (ohnedns):
ipconfig /all
pause
GOTO RESET
:ohnegw
cls
echo Die Einstellungen werden vorgenommen...(ohnegw)
netsh interface ip set address "LAN-Verbindung" static %ip% %mask%
netsh interface ip set dns "LAN-Verbindung" static %dns%
netsh interface ip delete address "LAN-Verbindung" gateway=all
echo IP-Konfiguration (ohnegw):
ipconfig /all
pause
GOTO RESET
:ohnegwdns
cls
echo Die Einstellungen werden vorgenommen...(ohnegwdns)
netsh interface ip set address "LAN-Verbindung" static %ip% %mask%
netsh interface ip delete address "LAN-Verbindung" gateway=all
netsh interface ip delete dns "LAN-Verbindung" all
echo IP-Konfiguration (ohnegwdns):
ipconfig /all
pause
GOTO RESET
:RESET
set ip=
set mask=
set dns=
set gw=
arp -d *
ipconfig /flushdns
EXIT
|
Allerdings bräuchte ich noch Hilfe in der Zeile:
if "%gw%""=="" AND "%dns%=="" GOTO ohnegwdns
|
Nur für den Fall, dass weder DNS NOCH Gateway eingetragen wird, soll er nach :ohnegwdns hüpfen.
Weiss aber die Syntax ned :-)
Dann wäre eigentlich die Fehlerroutine komplett. Ausser, dass die Netzwerkverbindung "LAN-Verbindung" heissen muss.
Aber naja :p