netshコマンド
WindowsXPでIPの設定を簡単に変更したいときはnetshコマンド。
netsh interface dump > ipdump1.txt
でスクリプトダンプ。
netsh -f ipdump1.txt
でスクリプトの実行(復元)。 netsh interface dump でダンプしたファイルを見ればnetshコマンド自体の使い方がわかる。
固定IPの設定→ netsh interface ip set address "interfacename" static (ipaddres) (mask)
サンプル:
netsh interface ip set address "ローカル エリア接続" static 192.168.0.2
デフォルトゲートウェイの設定→ netsh interface ip set address name="interface名" gateway=(デフォルトGWアドレス) gwmetric=1
サンプル:
netsh interface ip set address name="ローカル エリア接続" gateway=192.168.0.1 gwmetric=1
プライマリDNSのアドレス → netsh interface ip set dns name="interface名" source=static addr=(プライマリDNSのアドレス) register=PRIMARY
サンプル:
netsh interface ip set dns name="ローカル エリア接続" source=static addr=192.168.1.1 register=PRIMARY
セカンダリDNSのアドレス→ netsh interface ip add dns name="interface名" addr=(セカンダリDNSのアドレス) index=2
サンプル:
netsh interface ip add dns name="ローカル エリア接続" addr=192.168.2.1 index=2
WINSサーバーのアドレス → netsh interface ip set wins name="interface名" source=static addr=(WINSサーバーのアドレス)
サンプル:
netsh interface ip set wins name="ローカル エリア接続" source=static addr=192.168.1.128
DHCPにする → netsh interface ip set address name="interface名" source=dhcp
サンプル:
netsh interface ip set address name="ローカル エリア接続" source=dhcp
netshコマンドヘルプ → netsh ?
サンプル:
netsh ? netsh interface ? netsh interface ip ?