一、需要重啟 @echo offset /p pcnanme=請輸入電腦的名字:reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName /v ComputerName /t REG_SZ / ...
一、需要重啟
@echo off
set /p pcnanme=請輸入電腦的名字:
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName /v ComputerName /t REG_SZ /d %pcnanme% /f
eixt
需要重啟電腦才能生效
二、不需要重啟
@echo off
set /p name=輸入新的電腦名稱
wmic computersystem where "PrimaryOwnerName='%username%'" call rename %NAME%&exit
利用wmic改名不用重啟
通過修改註冊表修改主機名和工作組
@echo off
echo AppLife.Net
set /p 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 修改電腦名完畢
echo.
echo AppLife.Net
set /p work1=請輸入您的工作組名:
wmic computersystem where Name="%COMPUTERNAME%" call JoinDomainOrWorkgroup Name="%work1%"
echo 修改工作組完畢
pause>nul
echo.
不需要重啟