@echo Offecho.echo.echo automatically modifies the computer name and ipecho.set/p f= the IP suffix of the computer (value less than 255): Set name= test%f%set net= Local connection 3set ip=192.168.10. Set Mask=255.255.255.0set gateway=192.168.10.1set dns1=114.114.114.114set dns2=8.8.8.8reg Add "HKEY_CURRENT_USER\ Software\microsoft\windows\shellnoroam "/V @/T reg_sz/d"%name% "/F >nul REG Add" Hklm\system\currentcontrolset\cont Rol\computername\computername "/V" ComputerName "/t reg_sz/d"%name% "/F >nul REG Add" hklm\system\currentcontrolset\ Control\computername\activecomputername "/V" ComputerName "/t reg_sz/d"%name% "/F >nul REG Add" Hklm\system\currentc Ontrolset\services\eventlog "/V" ComputerName "/t reg_sz/d"%name% "/F >nul REG Add" Hklm\system\currentcontrolset\co Ntrol\computername\computername "/V" ComputerName "/t reg_sz/d"%name% "/F >nul REG Add" hklm\system\currentcontrolse T\services\tcpip\parameters "/V" NV Hostname "/t reg_sz/d"%name% "/F >nul REG Add" Hklm\system\currentcontrolset\serv Ices\tcpip\parameters "/V" Hostname "/t REG_SZ/D "%name%"/F >nulnetsh Interface IP set address "%net%" static%ip%%f%%mask%%gateway%netsh interface IP set DNS "%net%" Static%dns1% primarynetsh interface IP Add DNS "%net%"%dns2%echo modified configuration information is as follows: Echo.echo computer name%name%echo IP%ip%%f %echo Mask%mask%echo Gateway%gateway%echo dns1%dns1%echo dns2%dns2%echo.echo "Computer name and IP modification succeeded" pause
Windows modifies computer name and IP