How does “FOR” work in cmd batch file?

前端 未结 12 1071
面向向阳花
面向向阳花 2020-12-03 10:40

I\'ve been programming in dozens of languages for 20 years but I could never understand how \"FOR\" work in windows cmd shell batch file, no matter how hard I tried. I read

12条回答
  •  无人及你
    2020-12-03 10:59

    for /f iterates per line input, so in your program will only output first path.

    your program treats %PATH% as one-line input, and deliminate by ;, put first result to %%g, then output %%g (first deliminated path).

提交回复
热议问题