For loops in a batch file <p>I am using a batch file to convert data type of many climate files (*.nc). I used a for loop to iterate through the files. However, for some reason, it does not work properly. </p> <p>Here is my code:</p> <pre><code>@echo off for /l %%x in (2071,1,2100) do ( pause C:\NCO\ncap2 -s prec=float(prec) Prec_Order_%%x.nc Prec_Order_F_%%x.nc C:\NCO\ncap2 -s Tavg=float(Tavg) Tavg_Order_%%x.nc Tavg_Order_F_%%x.nc C:\NCO\ncap2 -s Tmax=float(Tmax) Tmax_Order_%%x.nc Tmax_Order_F_%%x.nc C:\NCO\ncap2 -s Tmin=float(Tmin) Tmin_Order_%%x.nc Tmin_Order_F_%%x.nc C:\NCO\ncap2 -s Wspd=float(Wspd) Wspd_Order_%%x.nc Wspd_Order_F_%%x.nc C:\NCO\ncap2 -s Srad=float(Srad) Srad_Order_%%x.nc Srad_Order_F_%%x.nc C:\NCO\ncap2 -s Hspec=float(Hspec) Hspec_Order_%%x.nc Hspec_Order_F_%%x.nc ) pause </code></pre> <p>The program does not work to the first pause. I've checked carefully, but cannot find out where the problem is in the line "for /l %%x in (2071,1,2100) do (". </p>