Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify computer name, workgroup and computer description with batch program

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how to modify computer names, workgroups, and computer descriptions using batch programs. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

The code is as follows:

@echo off

echo Junlong packaging computer name, computer description, working group modification batch processing program

Echo

pause

cls

:set/p id= Please enter the local segment number:

:set/p ip= Please enter your IP address:

:netsh interface ip set address name="local connection" 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= Dragon

wmic computersystem where Name="%NAME%" call JoinDomainOrWorkgroup Name="%work%"

set /p describe= Please enter a description of your computer (company policy requires 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

Batch modification of computer names and workgroups, no restart!

If you prefer a system mirrored by Ghost, the computer name after each reload is a long string of random characters, which is very inconvenient and unattractive.

Generally, if you change the computer name or workgroup in the system properties, you always have to restart, which is very troublesome. This is true even in the latest Vista operating system.

In fact, the computer name is saved in the registry, we can modify the registry directly to achieve the purpose of modification.

The code is as follows:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters

Workgroup modifications can be accomplished with a wmic command.

wmic computersystem where Name="%COMPUTERNAME%" call JoinDomainOrWorkgroup Name="%WORKGROUP%"

Now let's write it as a batch process to change the computer name and workgroup without restarting:

The 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 Modify computer name complete

echo.

echo AppLife.Net

set /p work1= Please enter your team name:

wmic computersystem where Name="%COMPUTERNAME%" call JoinDomainOrWorkgroup Name="%work1%"

echo Modify the working group finished

pause>nul

echo.

Save the above code as a bat file and run it.

Thank you for reading! About "how to use batch processing program to modify computer name, workgroup, computer description" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report