How to expand a CMD shell variable twice (recursively)

后端 未结 7 995
温柔的废话
温柔的废话 2020-12-01 13:03

Using the Windows XP CMD command-line I can expand a variable twice as follows:

set AAA=BBB
set BBB=CCC
for /F \"usebackq tokens=*\" %i in (`echo %%AAA%%`) d         


        
相关标签:
7条回答
  • 2020-12-01 13:55

    Double indirection (which is a very apt way pax has put it) reminds of C pointer de-referencing.
    I doubt that is supported in the Windows command shell.

    Do you think the larger purpose you are targeting can be achieved with something easier;
    maybe lesser of a code-golf approach then the one contrived nicely by pax?

    0 讨论(0)
提交回复
热议问题