There is example how to change router or switch name on new or equipment with deleted configuration files. In this case, it is changing default router name from ROUTER to R1.
First, skip wizard for equipment settings.
Continue with configuration dialog? [yes/no]: n press enter
Press RETURN to get started!
Enable privileged EXEC mode.
Router>enable press enter
From privileged EXEC mode, enters global configuration mode
Router#config terminal press enter
Enter configuration commands, one per line. End with CNTL/Z.
Change host name
Router(config)#hostname R1 press enter
Exit global configuration mode
R1(config)#exit press enter
R1#
%SYS-5-CONFIG_I: Configured from console by console
Save settings to startup-config file from running memory.
R1#copy running-config startup-config press enter
Destination filename [startup-config]? press enter
Building configuration…
[OK]
Exit privileged exec mode
R1#exit press enter
R1 con0 is now available
Press RETURN to get started.
Short version of example is
Router >enable
config t
hostname R1
exit
copy run start
exit