@echo off
echo %1
echo finished moving of files
rename error.dat %1
There is nothing wrong with your code. Works fine. You cannot have duplicate file names in the same directory.
File cannot be found could mean the file does not exist (error.dat) or there is a spelling error.
C:\Temp>dir
Volume in drive C is xpSystem
Volume Serial Number is 60D0-12D6
Directory of C:\Temp
11/04/2009 09:22 AM <DIR> .
11/04/2009 09:22 AM <DIR> ..
11/04/2009 09:16 AM 2 error.dat
11/04/2009 09:16 AM 73 Test.bat
2 File(s) 75 bytes
2 Dir(s) 1,739,354,112 bytes free
C:\Temp>test 20090220-TESTMOVE.RPT
20090220-TESTMOVE.RPT
finished moving of files
C:\Temp>dir
Volume in drive C is xpSystem
Volume Serial Number is 60D0-12D6
Directory of C:\Temp
11/04/2009 09:22 AM <DIR> .
11/04/2009 09:22 AM <DIR> ..
11/04/2009 09:16 AM 2 20090220-TESTMOVE.RPT
11/04/2009 09:16 AM 73 Test.bat
2 File(s) 75 bytes
2 Dir(s) 1,739,354,112 bytes free
C:\Temp>
place the %1 in quotes, as in, "%1".
Quotes are only required if a file name has embedded spaces or special characters that would mess up the interpreter. That does not appear to be the case here.
