Krishna Basude
Krishna Basude

Reputation: 23

Why does %%I work in .cmd?

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?

Upvotes: 0

Views: 264

Answers (1)

SomethingDark
SomethingDark

Reputation: 14325

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.

Upvotes: 1

Related Questions