Changing Computer Name from the command line on Windows 10
Here is a way to change your Windows computer’s name from the command line. [Source: Password Recovery Blog]
The command line needs to be running as Administrator (Win+X, Command Prompt (Admin)).
Renaming the computer
Now, run the following command:
wmic computersystem where caption='current_pc_name' rename new_pc_name
Replace current_pc_name with your current computer name, and new_pc_name with your desired new computer name.
After running the command, you will need to reboot for the changes to become effective.
Getting the current name
To determine the current name of the computer, you can use the following command:
wmic computersystem get caption