1

I have an image file named first%20second.png

I have a test.bat file that renames images.

It looks like this:

Timeout 3
Copy "C:\first%20second.png" "C:\sub\first%20second.png"
Timeout 3

When the batch file runs it does this instead

Copy "C:\first0second.png" "C:\sub\first0second.png"

The %2 does not get included

why is this?

Demonstration of the occurrence

enter image description here

2

1 Answer 1

1

You need to double the percent sign to escape it properly in a batch script.

Command

Copy "C:\first%%20second.png" "C:\sub\first%%20second.png"

Further Resources

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .