Windows – How can I stop percentage expansion in a batch file?

(This is on NT based Windows like 2000, XP, Vista, 7)

On the command-line, the percentage characters are ignored:

wget "http://www.justitie.nl/images/Handleiding%20voor%20verwerkers%20persoonsgegevens_tcm34-3940.pdf"

So it correctly downloads this file (each %20 becomes a space):

"http://www.justitie.nl/images/Handleiding voor verwerkers persoonsgegevens_tcm34-3940.pdf"

But inside a batchfile, all the %20 are being interpreted as expanding parameter 2 (which is empty) resulting in this file to get downloaded (each %20 becomes 0):

"http://www.justitie.nl/images/Handleiding0voor0verwerkers0persoonsgegevens_tcm34-3940.pdf"

Is there a way to circumvent the percentage parameter expansion?

–jeroen

Solution:

Double the percent sign:

wget "http://www.justitie.nl/images/Handleiding%%20voor%%20verwerkers%%20persoonsgegevens_tcm34-3940.pdf"
๐Ÿ’ 

๐Ÿ”ต Best-selling hard drives, USB flash drives & SSDs everyone's buying.

Fast, reliable, and on sale now. Thousands pick these weekly โ€” don't miss Amazon's lowest storage prices.

โšก Top 10 Bestsellers
๐Ÿ† 4.7โ˜…+ Reviews
๐Ÿ“ฆ Prime Shipping
๐Ÿ‘‰ See today's best-selling Data storage on Amazon.com HDD ยท USB Flash Drives ยท SSD ยท External Drives
๐Ÿ›’
โœ… Updated hourly โ€” Amazon real-time ranking ๐Ÿ”ฅ Limited stock deals ๐Ÿ”— Affiliate
โญ Click to see complete best-selling list โญ
Scroll to Top