本帖最后由 meiszp 于 2024-7-10 08:35 编辑
第一段代码运行没有问题,但改写成循环,第二段代码运行闪退,求原因。- @echo off
- setlocal enabledelayedexpansion
- echo 111.dat
- set start2=%time%
- echo !start2!
- set /a startTime2=!time:~0,2!*3600 + (1!time:~3,2!-100)*60 + 1!time:~6,2!-100
- echo %startTime2%
- endlocal
- pause
复制代码 改成循环- @echo off
- setlocal enabledelayedexpansion
- for %%f in (*.dat) do (
- set "filename=%%~f"
- echo !filename!
- set start2=%time%
- echo !start2!
- set /a startTime2=!time:~0,2!*3600 + (1!time:~3,2!-100)*60 + 1!time:~6,2!-100
- echo %startTime2%
- )
- endlocal
- pause
复制代码
|