Windows10 default gateway settings
■ Environment
OS: Windows10
Command prompt batch file
When you exit with a VPN software, the default gateway set with static IP disappears.
I made an inquiry to the company that produces this software, but it was answered that there was no solution.
■ Solution
Since there are hundreds of people, I want to create and deploy a batch file.
In order to set the default gateway to a batch file, it is necessary to set the IP address + subnet mask + default gateway.
Since the IP address has not disappeared, I think it is necessary to extract the IP address of each PC and set the default gateway.
I tried to create the following as a beginner, but it didn't work. . I would appreciate your teaching.
■ Command * mask and gateway are described appropriately. All subnet masks are/24
Get REM IP address
for/F "tokens = 15"% i in ('ipconfig ^ | find "IPv4 address"') do @set MYIP =% i
REM IP address setting
netsh interface ipv4 set add name = "Ethernet" source = static addr = "% MYIP%" mask = "255.255.255.0" gateway = "192.168.1.1" gwmetric = 1
-
Answer # 1
Related articles
- json - i want to use jq select at the command prompt
- what is the h: or r: that comes to the beginning of the path when typing at the command prompt in windows10?
- youtube-dl command prompt error: unable to download video data: http error 403: forbidden
- python 3x - i want to execute the conda command in windows10
- java - i am stumbling at the command prompt used when installing codecrumbs
- python - when you execute the exe file, the command prompt starts first
- include path in mingw command prompt
- html - i get the error prompt is not defined command = prompt ('the enemy has appeared! ([1] attack [2] escape)');
- command prompt - what to do if cmd is not recognized
- command prompt - i can't "firebase deploy"
- Use npm command prompt:&# 39;npm&# 39;is not an internal or external command, nor is it a method of processing executabl
- ncbi-blast + returns "not enough free space" error in command prompt
- python - xxpy cannot be executed at the command prompt
- command prompt - i want to create a batch file that extracts an ip address from ipconfig with a dos command and creates an lnk f
- command prompt - stores command execution results in environment variables
- python not working at command prompt
- run php in command prompt
- command prompt - unable to build and run jar with spring boot
- unable to register current directory of command prompt
- ruby - is programming possible at the command prompt?
Assuming you are writing as is,
First.
% i
is input from the command line, and%% i
when writing to a batch file.Second.
The command
set MYIP = 1.1.1.1
setsblank 1.1.1.1
to the environment variableMYIP space
.If you want to set
1.1.1.1
to the environment variableMYIP
,set MYIP = 1.1.1.1
.(Environment variable names can contain spaces and some symbols)