0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【windows10】IPアドレス設定用をbatファイルを作成した(標準入力)

Posted at

はじめまして!

windows10のIPアドレス設定用を行うためのbatファイルを作成したので、備忘録代わりに投稿します。

@echo off

rem インターフェース名確認
ncpa.cpl

echo インターフェイス名:
set /p interface_name=
echo IPアドレス:
set /p ip_address=
echo サブネットマスク:
set /p subnet_mask=
echo デフォルトゲートウェイ:
set /p default_gateway=
echo 優先DNSサーバー:
set /p dns_priority=
echo 代替DNSサーバー:
set /p dns_alternative=


rem DHCPで初期化
netsh interface ipv4 set add name="%interface_name%" source=dhcp
netsh interface ipv4 set dns name="%interface_name%" source=dhcp

rem 固定IP設定
netsh interface ipv4 set add name="%interface_name%" source=static addr="%ip_address%" mask="%subnet_mask%" gateway="%default_gateway%"
netsh interface ipv4 set dns name="%interface_name%" source=static addr="%dns_priority%" register=non validate=no
netsh interface ipv4 add dns name="%interface_name%" addr="%dns_alternative%" index=2 validate=no

pause

※管理者で実行してください

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?