把以下文章保存批处理文件,如保存为a.bat ,运行,修改你需要改的计算机名即可!
2 c/ I; S/ [ A: p; ]' B4 K6 m以下是代码段:
. y5 Z; p. g; \- i/ o, o
1 T. `5 Y, e0 B0 K@echo off
9 ]/ p9 D( @/ y& e3 M: q0 \- Y1 zset /p name=请输您的计算机名:
# b5 h2 D' ~: o @: L$ hreg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %name% /f >nul 2>nul. \5 |" c3 P5 O: ], `( H
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %name% /f >nul 2>nul% N! s0 t& _$ I- I
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %name% /f >nul 2>nul
, R/ h/ _3 C* M0 A7 ?* t8 T, |6 h; r/ }4 {0 _4 ^3 K
echo.
- n; s1 n" H# ]7 r1 q% v. secho 修改计算机名完毕! }: X6 s7 ~! }: S
echo.
. E9 {. U% o& _ S$ |7 U6 a" }3 h& _set /p work1=请输入您的工作组名:$ \0 H) H! R3 x, T) U8 A# S
wmic computersystem where Name="%COMPUTERNAME%" call JoinDomainOrWorkgroup Name="%work1%"
& o# ^ {4 o6 Pecho 修改工作组完毕
$ U$ v+ ^, p" c8 C. j- Apause>nul. e- C% A% P- Z
echo. |