@ECHO off setlocal enabledelayedexpansion ECHO 改计算机名为IP地址后两位 taskkill /im WinosInfo.exe /f /t >NUL 2>NUL for /f "tokens=2 delims=:" %%i in ('ipconfig ^|findstr /ic:"IPv4 地址"') do (SET SERVERIP=%%i) set "SERVERIP=!SERVERIP: =!" for /f "tokens=1-4 delims=." %%i in ("%SERVERIP%") do (SET SERVERIP=%%i.%%j.%%k.%%l) set PCNAME=%SERVERIP% ECHO 修改计算机名为%PCNAME% REG ADD "HKLM\SYSTEM\ControlSet001\Control\ComputerName\ComputerName" /f /v "ComputerName" /t REG_SZ /d "%PCNAME%" >NUL 2>NUL REG ADD "HKLM\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName" /f /v "ComputerName" /t REG_SZ /d "%PCNAME%" >NUL 2>NUL REG ADD "HKLM\SYSTEM\ControlSet001\services\Tcpip\Parameters" /f /v "hostname" /t REG_SZ /d "%PCNAME%" >NUL 2>NUL REG ADD "HKLM\SYSTEM\ControlSet001\services\Tcpip\Parameters" /f /v "NV Hostname" /t REG_SZ /d "%PCNAME%" >NUL 2>NUL REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /f /v "ComputerName" /t REG_SZ /d "%PCNAME%" >NUL 2>NUL REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName" /f /v "ComputerName" /t REG_SZ /d "%PCNAME%" >NUL 2>NUL REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /f /v "hostname" /t REG_SZ /d "%PCNAME%" >NUL 2>NUL REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /f /v "NV Hostname" /t REG_SZ /d "%PCNAME%" >NUL 2>NUL ECHO 已修改计算机名为%PCNAME% start "" "%ProgramFiles%\WinosInfo\WinosInfo.exe" pause
已有 35 位网友参与,快来吐槽:
发表评论