You can try like this :
@echo off
set Source=C:\TEMP\MyDoc.txt
set Destination=E:\MyData\
set Filename=MyDoc
set a=1
:loop
if exist %Destination%\%Filename%(%a%).txt set /a a+=1 && goto :loop
copy %Source% %Destination%\%Filename%(%a%).txt
pause
More Related Contents:
- Batch file to copy directories recursively
- Progress bar shows "echo is OFF" message
- Batch – Commenting on YouTube [closed]
- Where does GOTO :EOF return to?
- How to set environment variables with spaces?
- What are the ERRORLEVEL values set by internal cmd.exe commands?
- Split long commands in multiple lines through Windows batch file
- How to request Administrator access inside a batch file
- Can I mask an input text in a bat file?
- Logical operators (“and”, “or”) in DOS batch
- How do you loop in a Windows batch file?
- How do I make a batch file terminate upon encountering an error?
- Batch script to find and replace a string in text file without creating an extra output file for storing the modified file
- batch cmd exits as I enter the input with space
- BAT file: Open new cmd window and execute a command in there
- Set output of a command as a variable (with pipes) [duplicate]
- ERRORLEVEL inside IF
- batch script – read line by line
- windows batch files: setting variable in for loop
- How do I compare timestamps of files in a batch script?
- Why are Danish characters not displayed as in text editor on executing batch file?
- How can I escape an exclamation mark ! in cmd scripts?
- How to set a timeout for a process under Windows 7?
- How do I make one particular line of a batch file a different color then the others?
- Batch – Converting variable to uppercase
- Batch rename sequential files by padding with zeroes
- How to loop through comma separated string in batch?
- Batch File To Play A Song
- To “Call” or “Not to Call” a batch file?
- Mapping a network drive without hardcoding a drive letter in a batch file