You can find scripts from a quick google that you could drop into a bat file and handle this but I would like to propose you look into powershell to handle this problem.
$SourceFile = "C:\Temp\File.txt"
$DestinationFile = "C:\Temp\NonexistentDirectory\File.txt"
If (Test-Path $DestinationFile) {
$i = 0
While (Test-Path $DestinationFile) {
$i += 1
$DestinationFile = "C:\Temp\NonexistentDirectory\File$i.txt"
}
} Else {
New-Item -ItemType File -Path $DestinationFile -Force
}
Copy-Item -Path $SourceFile -Destination $DestinationFile -Force
You could call powershell from the command line if you wanted to so this answer technically fits the requirement. Powershell will make these kinds of tasks easier and give you more flexibility if you want to make any other changes to the copy operation.
How to Copy Individual Files and Rename Duplicates with Powershell