Search code examples
batch-filecommanddosfilenames

copy command in DOS is not recognizing when filename has '='


I wrote batch script to copy a file and write a log. However copy is not working when the file name is like this:

8001#121122213500#1002#00#M=MRN100#C=Test_Large_File2.wav

On further checking I found this is because of the = in the filename.

I also tested individually. When I use copy *.wav d:\wav file is getting copied, but when I use

copy 8001#121122213500#1002#00#M=MRN100#C=Test_Large_File2.wav d:\wav

I get an message that the file is not found.

Can any one help me in resolving this. I also tried searching old posts here but couldn't find any.

Thanks


Solution

  • You need to quote the filename

    copy "8001#121122213500#1002#00#M=MRN100#C=Test_Large_File2.wav" d:\wav