0

I have found in multiple online forums and blogs that .cmd files utilize %I (or %A, etc.) for loops and batch files require two percent symbols (%%I). However, this line of code has been working well for me in a .cmd file:

FOR /L %%I IN (%case%, 1, %endcase%) DO (
aws s3 cp s3://[URL]/%user%/%%I "C:\Users\[directories]\Accuracy_Testing\datax\%user%_%%I" --recursive
) 

In this code, I am using the command line interface for AWS to download files associated with multiple IDs. case and endcase are arguments parsed to the file.

Why does this work, when .cmd files should be using %I instead of %%I?

  • Please see also [Windows batch files: .bat vs .cmd?](https://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd) – Mofi Aug 15 '17 at 18:44

1 Answers1

1

You're confusing .cmd files with the CMD prompt. .cmd files are essentially batch files (with a few differences that most people won't notice), while the CMD prompt is the command line itself.

Scripts use %%I, the command prompt uses %I.

SomethingDark
  • 13,229
  • 5
  • 50
  • 55