“continue” equivalent command in nested loop in Windows Batch

前端 未结 2 1637
忘了有多久
忘了有多久 2021-02-08 20:20

I have a batch file which contains nested loop with continue-like command:

for %%i in (1, 2, 4, 8, 16, 32, 64, 128, 256) do (
    for %%j in (1, 2,          


        
2条回答
  •  隐瞒了意图╮
    2021-02-08 20:33

    it seems what you are actually trying to accomplish is a poor man's "less or equal than".
    In this case, why not use the real "less or equal than", which is LEQ?
    Additionally, you seem to want the output of test.exe in the "%%i_%%j".txt file, so don't use echo.

    So this would be

    for %%i in (1, 2, 4, 8, 16, 32, 64, 128, 256) do (
        for %%j in (1, 2, 4, 8, 16, 32, 64, 128, 256) do (
            if %%i LEQ %%j test.exe 0 %%i %%j 100000 > "%%i_%%j".txt
        )
    )
    

提交回复
热议问题