Skip to content

Instantly share code, notes, and snippets.

@acetwenty8
Created November 2, 2015 23:40
Show Gist options
  • Save acetwenty8/310daecc5754d126958c to your computer and use it in GitHub Desktop.
Save acetwenty8/310daecc5754d126958c to your computer and use it in GitHub Desktop.
Script to rename Windows system to serial number
@echo off
for /F "skip=1 delims=" %%j in ('wmic bios get serialnumber') do (
set SERIAL=%%j
goto :DONE
)
:DONE
set src=%SERIAL%&set DummyForSpacesAtTheEnd=x
echo [%src%]
for /f "delims=" %%A in ('echo %src%') do call :Sub1 %%A
echo [%src%]
:Sub1
set src=%*
wmic ComputerSystem where Name="%COMPUTERNAME%" Rename Name=%src%
shutdown /t 30 /r /f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment