您好,登錄后才能下訂單哦!
第一種:
Dim reval
Set objnet = CreateObject ("WScript.Network")
Set R = CreateObject("WScript.Shell")
reval = InputBox ("當前的計算機名是:" & objnet.ComputerName,"輸入新的計算機名")
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
err = objComputer.Rename(objnet.ComputerName)
Next
For Each objComputer in colComputers
errReturn = ObjComputer.Rename (reval)
If reval <> "" Then
return=MsgBox ("你確定要重起計算機嗎?",vbokcancel+vbexclamation,"注意!")
If return=vbok Then
R.run("Shutdown.exe -r -t 0")
End if
End If
Next
第二種:自動改成該電腦的序列號
'Rename computer by serial # v1.0 November 2009
dim Bios, BiosSerial, objFSO, objTextFile
'Const ForReading = 1, ForWriting = 2, ForAppending = 8
'get serial number
for each Bios in GetObject("winmgmts:").InstancesOf ("win32_bios")
BiosSerial = Bios.SerialNumber
exit for
next
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
err = objComputer.Rename(BiosSerial)
Next
'messagebox
msgbox "Computername changed to " + BiosSerial + "...", yes
第三種:改成自己設置的前綴名+時間
@echo off
mode con cols=45 lines=8
title 計算機名更改
color f8
set f=%time:~3,-6%
set m=%time:~6,-3%
echo.
echo.
echo.
set /p name= 前綴名:
echo.
echo.
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam" /v @ /t REG_SZ /d "%name%%f%%m%" /f >nul && reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v "ComputerName" /t REG_SZ /d "%name%%f%%m%" /f >nul && reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v "ComputerName" /t REG_SZ /d "%name%%f%%m%" /f >nul && reg add "HKLM\SYSTEM\CurrentControlSet\Services\Eventlog" /v "ComputerName" /t REG_SZ /d "%name%%f%%m%" /f >nul && reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v "ComputerName" /t REG_SZ /d "%name%%f%%m%" /f >nul && reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t REG_SZ /d "%name%%f%%m%" /f >nul && reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "Hostname" /t REG_SZ /d "%name%%f%%m%" /f >nul
IF %ERRORLEVEL%==0 goto t
goto n
:t
echo.
echo.
echo.
echo 修改成功,要使更改生效,必須重新啟動計算機.
echo.
echo.
echo.
pause
mode con cols=45 lines=8
title 系統設置改變
echo.
echo.
echo 必須重新啟動計算機才能使新的設置生效。
echo.
echo 想現在就重新啟動計算機嗎?
echo.
echo Y:確定 N:取消
echo.
set /p select1=請輸入:
if /i "%select1%"=="Y" goto y
if /i "%select1%"=="N" goto n
:y
shutdown -r -t 0
exit
:n
exit
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。