参见英文答案 >
String processing in windows batch files: How to pad value with leading zeros?7个
非常简单,我猜…我需要通过向下面的循环索引变量(%% i)添加前导零来获得可用变量.
非常简单,我猜…我需要通过向下面的循环索引变量(%% i)添加前导零来获得可用变量.
@echo off for /L %%i in (1,1,5) do ( echo %%i rem How to create a variable j here as a rem result of adding leading zeros to %%i? (001,002,003 etc.) ) pause
怎么样?
我已经尝试了以下内容,但是我无法从%% i变量中获取值.在var_ at …
@echo off & setlocal enableextensions for /L %%i in (1,5) do ( echo %%i set var_=00000%%i set var_=%var_:~-5% echo %var_% ) pause