Copy Code code as follows:
@echo off
Echo Chun Long packaging computer name, computer description, workgroup modify Batch Program
Echo
Pause
Cls
: set/p id= Please enter the local network segment number:
: set/p ip= Please enter the native IP address:
: netsh interface ip set address name= "Local Area Connection" Source=static addr=192.168.%id%.%ip% mask=255.255.255.0
set/p name= Please lose your host factory s/n number:
REG ADD "Hkey_local_machine\system\currentcontrolset\control\computername\activecomputername"/V computername/t reg _SZ/D%name%/F
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"/V "NV Hostname"/reg_sz/d%name%/F
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"/V hostname/t reg_sz/d%name%/F
SET work= Chun Long
WMIC ComputerSystem where name= "%name%" Call JoinDomainOrWorkgroup name= "%work%"
set/p describe= Please enter your computer description (company specified must be user name):
REG ADD "Hkey_local_machine\system\currentcontrolset\services\lanmanserver\parameters"/V srvcomment/t reg_sz/d% Describe%/F
NET config server/srvcomment: "%describe%"
Pause
Modify the computer name and workgroup with a batch without rebooting!
If you like to use Ghost mirror system, then each reload after the completion of the computer name is a string of long random characters, very inconvenient and not beautiful.
In general, you modify the computer name or workgroup in the system properties, always reboot, very troublesome. Even in the latest Vista operating system.
In fact, the computer name is stored in the registry, we can modify the registry directly, to achieve the purpose of modification.
Copy Code code as follows:
Hkey_local_machine\system\currentcontrolset\control\computername\activecomputername
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
The changes to the workgroup can be accomplished by a WMIC command.
WMIC ComputerSystem where name= "%computername%" Call JoinDomainOrWorkgroup name= "%workgroup%"
Now we'll write it as a batch to implement the change of computer name and workgroup without rebooting:
Copy Code code as follows:
@echo off
Echo applife.net
set/p name= Please lose your computer name:
REG ADD "Hkey_local_machine\system\currentcontrolset\control\computername\activecomputername"/V computername/t reg _SZ/D%name%/F >nul 2>nul
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"/V "NV Hostname"/reg_sz/d%name%/F & Gt;nul 2>nul
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"/V hostname/t reg_sz/d%name%/F > Nul 2>nul
Echo.
Echo Modifies computer name complete
Echo.
Echo applife.net
set/p work1= Please enter your workgroup name:
WMIC ComputerSystem where name= "%computername%" Call JoinDomainOrWorkgroup name= "%work1%"
Echo Modify Workgroup complete
Pause>nul
Echo.
Save the above code as a bat file and run it.