I am copying a file from one folder into another folder. I would like to name the destination file in this specific way:
filename-currentdatetime-computername-username.txt
How do I do this using a batch file with Windows commands?
I need to get the original filename followed by the current system date time and then the computernaem and the user that is logged on
If you don’t care about the exact date format, this command will copy a file and include the date, time, user and machine name in the target file name.
The date and time will be in the default date format of your OS. Beware that some date formats can contain characters which are not allowed in file names.
To make the command portable you need to specify the format yourself. Here are exampled of how to create format dates that are valid in file names: Format date and time in a Windows batch script