批处理:怎样替换时间输出格式

2024-11-24 12:39:46
推荐回答(3个)
回答1:

用call 写在一行上,算不算精简?

set wind=%time: =%& call set wind=%%wind::=%%& call set wind=%%wind:.=%%
echo %wind%& pause

回答2:

都用到for还不懂啊,改一下即可:

@echo off
for /f "tokens=1-4 delims=:. " %%i in ('echo/%time%') do set var=%%i%%j%%k%%l
echo/%var%
pause>nul

回答3:

set MM=%TIME::=%
set NN=%MM:.=%
echo %NN%
pause