0

I have a piece of code i am trying to execute in a batch file it works fine when i run in in the command line but when i save it as a .bat file it fails with some weird symbols at the start of the line. This i think is related to the fact that the file type is UTF-8. I changed the encoding using notepad++ to ansi following the steps here from the thread Weird characters (´╗┐) at the start of a batch file

I tried to run the batch script now with the ANSI file format but it seems to ignore the PAUSE command so im unable to run the script or to trouble shoot it

Can anyone help

Script is

for /r "K:\Folder_A" %f in (*) do @xcopy /Y/D "%f" "C:\Folder_C"

3

1 Answer 1

2

Unlike when you run a For loop command at the command prompt, when referencing the variables within a batch file, you need to double up the percent signs (ie: %%f).

Perhaps check out this other SU question for more info: What does the percent sign (% and %%) in a batch file argument mean?

You must log in to answer this question.

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