So I needed to copy a file that had a suffix in it’s file name, indicating the financial calendar week it belonged to.
Enter iterative variables in windows. Similar to linux, but here’s the syntax so I don’t have to trawl the Microsoft Webiste again.
Syntax
for /L {%% ¦ %} variable in (start#,step#,end#) do command[CommandLineOptions]
My example
for /L %f in (1,1,52) do copy c:\tmp\wk.xlsm c:\tmp\wk%f.xlsm
I dislike 1-9 not having a zero in front of them, so I renamed them manually.
Leave a Reply