把以下文章保存批处理文件,如保存为a.bat ,运行,修改你需要改的计算机名即可!
. Y* b5 _7 ]; ^- A& b以下是代码段:/ x+ }7 a# c) S# s* ~* k9 g* h
# o2 V9 O6 j, u: ~
@echo off
' D* m+ x& F N4 M$ b; p' Aset /p name=请输您的计算机名:
# _/ b) _* Z1 D' T& }reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %name% /f >nul 2>nul5 c$ b# Z5 \% y; U O) M
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %name% /f >nul 2>nul
$ a' L! h' d* H- Lreg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %name% /f >nul 2>nul* v4 c6 t( f: q+ N, Y' v4 c
6 e- s& l! X& W5 ?+ f3 ]' N4 V
echo.6 w H1 U: ]4 v h" f
echo 修改计算机名完毕; @/ P4 _% b" f4 p6 R7 P4 j
echo.
2 ^. S- F2 `9 Y; f* g) v$ N hset /p work1=请输入您的工作组名:5 n0 B t0 g6 A( y# \ t
wmic computersystem where Name="%COMPUTERNAME%" call JoinDomainOrWorkgroup Name="%work1%"
; a0 c2 j7 ~3 Z$ L& t& ]5 L2 {4 _; u+ Oecho 修改工作组完毕
3 k9 N7 F- M5 H# d9 U( jpause>nul4 z9 x8 c; q, {( P6 y* I. G
echo. |