Batch-Script - Iterate through arguments

前端 未结 6 676
暖寄归人
暖寄归人 2020-12-08 18:49

I have a batch-script with multiple arguments. I am reading the total count of them and then run a for loop like this:

@echo off
setlocal enabledelayedexpans         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-08 19:37

    If to keep the code short rather than wise, then

    for %%x in (%*) do (
       echo Hey %%~x 
    )
    

提交回复
热议问题