So I'm trying to change my PC name using a batch file but when i run this code as administrator:
set /P PCNAME=Please enter Laptop Name:
set PCOLD=hostname
WMIC computersystem Where Name="%PCOLD%" Call rename "%PCNAME%"
It gives this error message: "No Instances available"
and if i replace "%PCOLD%" with hostname it gives this error message:
WMIC computersystem Where Name=hostname Call rename "%PCNAME%"
"ERROR: Description = Invalid query"
CodePudding user response:
Wmic ComputerSystem where Caption='%ComputerName%' rename example