Reality is a Fractal
Reality is a Fractal

Reputation: 67

How do I run this command in a batch file?

This is my batch script so far, but the files do not copy as desired. What is wrong with the script? The command "for /l %f... runs in cmdprompt, but not from a batch file.

echo off
echo Will it run?
pause
start for /l %f in (1,1,10) do copy "C:\Users\1\Desktop\medicine\m2_pics\fa2\Fa003b.jpg" "C:\Users\1\Desktop\medicine\m2_pics\fa2\Fa003b%f.jpg"
pause
exit

Upvotes: 0

Views: 67

Answers (1)

MichaelS
MichaelS

Reputation: 6042

Replace %f with %%f. That's it. Variables which you access with %varname in the cmd console always turn to %%varname within a bat.

Upvotes: 2

Related Questions