@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