1.

Solve : Time, in FOR [SOLVED]?

Answer»

I am trying to get the hours and minutes of the current system time in FOR, and SET the hours as %h% and the minutes as %m%...

For some reason, I can't set m=%%B in
Code: [SELECT]for /F "delims=:" %%a in ("%time%") do set m=%%bor
Code: [Select]for /f "delims=:" %%a in ("%time%") do set h=%%a & set m=%%b
Why is it not working??? I have a FEELING it is something obvious...

Just looked through the FAQ (I was bored) and found the solution!

Code: [Select]FOR /f "tokens=1-2 delims=/: " %%a in ("%time%") do (
set h=%%a
set m=%%b
)
echo %h%
echo %m%Quote from: Helpmeh on April 13, 2009, 05:46:57 PM

Just looked through the FAQ (I was bored) and found the solution!

You're supposed to do that before you ask the question. Quote from: Dias de verano on April 14, 2009, 11:15:20 AM
You're supposed to do that before you ask the question.
BUT, (and this is a good reason) some people may have the same problem and not know that the FAQ exists. I actually didn't know that there was a FAQ for MS-DOS.


Discussion

No Comment Found