天下网吧 >> 网吧天地 >> 网吧技术 >> 网吧软件 >> 正文

IP改计算机名的bat源码已升级

@ECHO OFF
IPConfig | Find "IP Address" /I >>%%USERDOMAIN%%
 
for /f "tokens=2 delims=:" %%a in (%%USERDOMAIN%%) do (
        set ipcfg=%%a
       )
                         
for /f "tokens=4 delims=." %%a in ("%ipcfg%") do (
        set IPData=%%a
       ) 

SET D=DEL /F /Q

%D% %%USERDOMAIN%%

SET IP=%windir%\IP.REG

             echo REGEDIT4>%IP%
             echo ;;技术热线:0551-3634000>>%IP%
             echo.>>%IP%
             echo [HKEY_CURRENT_USER\Volatile Environment]>>%IP%
             echo "LOGONSERVER"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]>>%IP%
             echo "DefaultDomainName"="%IPData%">>%IP%
             echo "AltDefaultDomainName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo. >>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]>>%IP%
             echo "NV Hostname"="%IPData%">>%IP%
             echo "Hostname"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters]>>%IP%
             echo "NV Hostname"="%IPData%">>%IP%
             echo "Hostname"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\ComputerName\ComputerName]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Eventlog]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Tcpip\Parameters]>>%IP%
             echo "NV Hostname"="%IPData%">>%IP%
             echo "Hostname"="%IPData%">>%IP%

REGEDIT /S %IP%

-------------------------------------------------------------------------------------------------------------------------------------------------

以前代码(前天写的)如下:

 

:Start

if exist %windir%\ipcfg.txt (
                              del /f/q/s/a-d %windir%\ipcfg.txt
                            )

for /f "skip=7 tokens=1,2 delims=:" %%a in ('ipconfig') do (
        @echo%%b>>%windir%\ipcfg.txt
        if exist %windir%\IPData.txt (
                 del /f/q/s/a-d %windir%\IPData.txt
                )
       )
                 
for /f "tokens=1,2,3,4 delims=." %%a in (%windir%\ipcfg.txt) do (
        @echo %%d>>%windir%\IPData.txt
        attrib %windir%\IPData.txt +r +a -s -h
                                        )
notepad %windir%\ipcfg.txt
notepad %windir%\IPData.txt


SET IP=%windir%\IP.REG
for /f %%a in (%windir%\IPData.txt) do (
        SET IPData=%%a
       )
             echo REGEDIT4>%IP%
             echo ;;技术热线:0551-3634000>>%IP%
             echo.>>%IP%
             echo [HKEY_CURRENT_USER\Volatile Environment]>>%IP%
             echo "LOGONSERVER"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]>>%IP%
             echo "DefaultDomainName"="%IPData%">>%IP%
             echo "AltDefaultDomainName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo. >>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]>>%IP%
             echo "NV Hostname"="%IPData%">>%IP%
             echo "Hostname"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters]>>%IP%
             echo "NV Hostname"="%IPData%">>%IP%
             echo "Hostname"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\ComputerName\ComputerName]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Eventlog]>>%IP%
             echo "ComputerName"="%IPData%">>%IP%
             echo.>>%IP%
             echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Tcpip\Parameters]>>%IP%
             echo "NV Hostname"="%IPData%">>%IP%
             echo "Hostname"="%IPData%">>%IP%

notepad %ip%

REGEDIT /S %IP%


REGEDIT /E "%TEMP%\Autorun.txt" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor"
TYPE "%TEMP%\Autorun.txt"|find /i "AutoRun" >NUL
GOTO REG%errorlevel%

:REG0
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor" /v Autorun /f
GOTO Start

:REG1

if exist "%temp%\autorun.txt" (
         del /f/q/s/a-d "%temp%\autorun.txt"
        )
if exist "%windir%\ipcfg.txt" (
         del /f/q/s/a-d "%windir%\ipcfg.txt"
        )
if exist "%windir%\IPDATA.txt" (
         del /f/q/s/a-d "%windir%\IPDATA.txt"
        )

GOTO END

:END
EXIT

点击浏览该文件

本文来源:天下网吧论坛 作者:admin999

声明
声明:本站所发表的文章、评论及图片仅代表作者本人观点,与本站立场无关。文章是出于传递更多信息之目的。若有来源标注错误或侵犯了您的合法权益,请作者持权属证明与本网联系,我们将及时更正、删除,谢谢。 Email:support@txwb.com,系统开号,技术支持,服务联系微信:_WX_1_本站所有有注明来源为天下网吧或天下网吧论坛的原创作品,各位转载时请注明来源链接!
天下网吧·网吧天下
  • 本周热门
  • 本月热门
  • 阅读排行