Escaping special characters batch for loop

I have a loop that iterates on a text file where I have several file paths.

The goal is to iterate throw file paths and copy them to a different location.

I’m not a windows beast (pref UNIX) but managed to make it works:

@echo off
For /f «tokens=* delims=« %%a inc(‘type file_list.txt’) do xcopy /hrkvy «%%a» « S:\dest_dir»

However it doesn’t work for paths that contain special characters. I have no idea how to scape those characters from a loop. Any idea?

Read more here:

Content Attribution

This content was originally published by Paul Bénéteau at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: