China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-29 17:56
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to automatically change the computer name using batch processing? View 7,748 Replies 11
Original Poster Posted 2006-11-09 00:33 ·  中国 广东 深圳 南山区 电信
新手上路
Credits 12
Posts 9
Joined 2006-03-17 17:55
20-year member
UID 52277
Status Offline
If there are many identical computers cloned and installed, and after installation, the computer names are all the same. Once connected to the Internet, the "There are duplicate names on the network" prompt will appear. Then how to use batch processing to change these computer names? The naming rule can adopt "prefix" + "last segment of the IP address". For example, if the prefix is set to H, and the IPs are 192.168.7.3; 192.168.7.147, then the computer names will be H3, H147 respectively.

----------------------------------------------------------------------------------------------------------
附带问 another question:
Still such a batch of computers, and the system properties are all the same information. For example:
Registered to:
USER
DELL
There will be a problem. For example, when I install OFFICE, Kingsoft Iceberg, the user name and unit will be automatically filled with these information. Is there a way to use batch processing to automatically change the registration information?
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
electronixtar -16 2006-11-09 04:08
Floor 2 Posted 2006-11-11 12:08 ·  中国 广东 深圳 宝安区 电信
初级用户
Credits 53
Posts 27
Joined 2005-07-18 20:40
20-year member
UID 40849
Status Offline
Passing by, paying attention to this issue.
Floor 3 Posted 2006-11-11 13:15 ·  中国 浙江 温州 电信
中级用户
★★
Credits 458
Posts 196
Joined 2006-10-05 12:04
19-year member
UID 64614
Status Offline
All this information is about modifying the registry.

The computer name can be modified by calling the Control Panel or by calling the Registry Editor. For example, to change the computer name from 'MMX233' to 'P233', you can follow these steps: Open HKEY_LOCAL_MACHINE\System\CurrenControlSet\Control\ComputerName\ComputerName, change the value of the key named 'ComputerName' from the original 'MMX233' to 'P233', and it will take effect after logging off the user or restarting Windows.

Find some materials for personalizing the computer by modifying the registry to have a look.

Find the modification points, and you can use batch processing/vbs to make the change, which is very easy :D

[ Last edited by zerocq on 2006-11-11 at 01:17 PM ]
Floor 4 Posted 2006-11-11 21:33 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
There are quite a few such problems in the forum. Just search it. Also, there is in Wuyou Boot Forum.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 5 Posted 2006-11-13 07:43
中级用户
★★
DOS之日
Credits 337
Posts 161
Joined 2006-11-04 05:27
19-year member
UID 69523
Gender Male
Status Offline
I will also pay attention.
for /f %%h in (`echo hxuan`) do for /f %%x in (`echo hxuan`) do if %%h==%%x nul
Floor 6 Posted 2006-11-16 19:52 ·  美国 科罗拉多州 阿拉珀霍 利特尔顿 TW_Telecom控股股份有限公司
初级用户
Credits 35
Posts 18
Joined 2006-04-26 13:31
20-year member
UID 54481
Status Offline
I found two tools that are both in the Ghost 8.3 suite:
(1) ghstwalk.exe: Rename Windows under pure DOS, can specify a name or assign randomly
(2) GhRegEdt.exe: Modify Windows registry under pure DOS, change the following key values:
HKLM\SYSTEM\ControlSet001\Control\ComputerName\ComputerName
ComputerName
HKLM\SYSTEM\ControlSet001\Services\Tcpip\Parameters
NV Hostname
Floor 7 Posted 2007-04-22 05:58 ·  中国 江苏 无锡 电信
初级用户
Credits 80
Posts 43
Joined 2007-04-21 23:44
19-year member
UID 86017
Gender Male
Status Offline
Heheh. I know this. To change the computer name, use wmic computersystem where "name='%nowname%'" call rename %name%

'%nowname%' is the current name, %name% is the name you want to change to.

Similarly: To change the workgroup
wmic computersystem where "domain='%work%'" call joindomainorworkgroup "","","%group%",1

[ Last edited by tyh on 2007-4-21 at 05:05 PM ]
Floor 8 Posted 2007-04-23 03:37 ·  中国 广西 玉林 电信
新手上路
Credits 6
Posts 6
Joined 2007-03-17 12:10
19-year member
UID 82066
Gender Male
Status Offline
Floor 9 Posted 2007-04-24 04:15 ·  中国 湖南 长沙 联通
初级用户
Credits 60
Posts 34
Joined 2007-04-24 02:13
19-year member
UID 86232
Gender Male
Status Offline
Floor 10 Posted 2007-04-24 05:40 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
RE:LS

Sure!


Try this; automatically change your computer name to a name combined with H and the last digit of the IP.

Tested on xpsp2


  1. @echo off
  2. for /f "tokens=17 delims=:." %%a in ('ipconfig ^|findstr "IP Address" ^| more +1') do set "NAME=H%%a"
  3. echo %NAME%
  4. wmic computersystem where "PrimaryOwnerName='%username%'" call rename %NAME%
Posted by BJSH on: 2007-04-23 16:25
Floor 11 Posted 2008-03-13 11:38 ·  中国 江西 上饶 电信
新手上路
Credits 6
Posts 3
Joined 2007-09-12 15:59
18-year member
UID 97196
Gender Male
Status Offline
Floor 12 Posted 2010-05-29 11:06 ·  中国 浙江 温州 电信
新手上路
Credits 9
Posts 6
Joined 2010-05-27 09:32
16-year member
UID 167695
Gender Male
Status Offline
A batch file for modifying the computer name found online
-----------------------------
@echo off
title Modify Computer Name
set /p cname=Please enter the computer name:

echo REGEDIT4 >name.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName] >> name.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName] >> name.reg
echo "ComputerName"="%cname%" >> name.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName] >> name.reg
echo "ComputerName"="%cname%" >> name.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\ComputerName\ComputerName] >> name.reg
echo "ComputerName"="%cname%" >> name.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] >> name.reg
echo "NV Hostname"="%cname%" >> name.reg
echo "Hostname"="%cname%" >> name.reg

echo [HKEY_USERS\S-1-5-18\Software\Microsoft\Windows\ShellNoRoam] >> name.reg
echo @="%cname%" >> name.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName] >> name.reg
echo "ComputerName"="%cname%" >> name.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters] >> name.reg
echo "NV Hostname"="%cname%" >> name.reg
echo "Hostname"="%cname%" >> name.reg

echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] >> name.reg
echo "DefaultDomainName"="%cname%" >> name.reg
echo "AltDefaultDomainName"="%cname%" >> name.reg
name.reg
pause
Forum Jump: