Copy codeThe Code is as follows: @ echo off
Echo Junlong packaging computer name, computer description, workgroup modification batch processing program
Echo
Pause
Cls
: Set/p id = enter the local CIDR block number:
: Set/p ip = enter the local ip Address:
: Netsh interface ip set address name = "" source = static addr = 192.168.% id %. % ip % mask = 255.255.255.0
Set/p name = enter 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"/t 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 = Junlong
Wmic computersystem where Name = "% NAME %" call JoinDomainOrWorkgroup Name = "% work %"
Set/p describe = enter your computer description (the company requires the 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
Use batch processing to modify the computer name and Working Group. Do not restart!
If you like a system with a Ghost image, the computer name after each reinstallation is a long string of random characters, which is inconvenient and not beautiful.
Generally, it is very troublesome to modify the computer name or working group in the system attribute. This is even true in the latest Vista operating system.
In fact, the computer name is saved in the registry. We can modify the Registry directly.
Copy codeThe Code is as follows: HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Control \ ComputerName \ ActiveComputerName
HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Services \ Tcpip \ Parameters
You can use a wmic command to modify the workgroup.
Wmic computersystem where Name = "% COMPUTERNAME %" call JoinDomainOrWorkgroup Name = "% WORKGROUP %"
Now we write it as a batch process to implement the change of the computer name and working group without restarting:
Copy codeThe Code is as follows: @ echo off
Echo AppLife. Net
Set/p name = enter 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"/t reg_sz/d % name %/f> 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: computer name modified
Echo.
Echo AppLife. Net
Set/p work1 = enter your workgroup name:
Wmic computersystem where Name = "% COMPUTERNAME %" call JoinDomainOrWorkgroup Name = "% work1 %"
Echo modified workgroup
Pause> nul
Echo.
Save the above Code as a bat file and run it.