把以下文章保存批处理文件,如保存为a.bat ,运行,修改你需要改的计算机名即可!
' K" t& q6 b% @: s$ \以下是代码段:' u7 V% F( H# i: ]0 G, y
0 A* u0 R0 f: y; V
@echo off p8 g% E6 u6 K1 a
set /p name=请输您的计算机名:8 B" u+ z( @& u4 c/ l1 V( W8 Q2 q$ ^
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %name% /f >nul 2>nul3 u; N; e* I" y( `, h: v# I
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %name% /f >nul 2>nul
) @0 L$ q' ~! g! r2 \" zreg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %name% /f >nul 2>nul
1 v) l4 b2 h9 C6 E
: T" l8 q% p2 H- c* Mecho.& f* M% Q% J: S/ @; D" |
echo 修改计算机名完毕
) ]% A5 v% O! w) r3 ?% Y7 a Y. Vecho.
# ]: H1 ], }: tset /p work1=请输入您的工作组名:
. ? J6 D/ _/ L0 |wmic computersystem where Name="%COMPUTERNAME%" call JoinDomainOrWorkgroup Name="%work1%"
- }6 V4 I: |$ d- n6 u3 l$ l! Qecho 修改工作组完毕+ A! Y: l2 R& Z9 [/ r
pause>nul4 ?/ u0 S: N7 O' N
echo. |