Rename file =Computer name

I want to rename a file in a comand line script  that renames an existing file to the computer's name.
Example change sourcefile.dat to Lap1.dat if that computer is named Lap1.

Thanks
kialdAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sirbountyConnect With a Mentor Commented:
ren sourcefile.dat %computername%.dat

should do it...
0
All Courses

From novice to tech pro — start learning today.