Vincent Tang
Vincent Tang

Reputation: 4170

cmd prompt works fine, but Batch file cannot handle % strings

I have this image sitting in my folder named

hello%5B1%5D.png

I run this command prompt script to copy an image with a new name

COPY "hello%5B1%5D.png" "New_Image_Name.png"

which works fine

but if I dump it inside a .bat file and double click .bat, it outputs this instead:

COPY "helloB1D.png" "New_Image_Name.png"

taking out the 5 and % inside the image name.

Is there an option to allow command prompt to handle % strings as input values, if they are enclosed by double quotation marks? ""

Upvotes: 0

Views: 43

Answers (1)

access_granted
access_granted

Reputation: 1907

COPY "hello%%5B1%%5D.png" "New_Image_Name.png"

Upvotes: 1

Related Questions