How do I perform string operations on variables in a for loop?

前端 未结 5 805
遇见更好的自我
遇见更好的自我 2021-02-06 06:57

This sounds dumb, but I can\'t get it to work. I think i just dont\' understand the difference between %%v, %v% and %v

Here\'s what I\'m trying to do:

5条回答
  •  既然无缘
    2021-02-06 07:51

    I am not as good at batch as the above (I use WSH or other script languages instead) but I can try and explain %%v %v and %v%.

    The first two forms are used in a for loop. help for explains the difference, the first form is used in a batch file while the second one is used when typing (pasting) the command directly at the command prompt.

    The last form just replaces the variable name (environment variable) with its value:

    set FOO=C:\bar\foo
    cd %FOO%\gah
    

提交回复
热议问题