1.

Solve : Help with parsing the %TIME command previously provided?

Answer»

Hello all again, been a while. Everything has been WORKING great but I need some clarification on a command given to me prior.

REM Set up the current time
set CURRENTHOUR=%TIME:~0,2%
if %CURRENTHOUR% LSS 10 set CURRENTHOUR=0%TIME:~1,1%
set CURDATETIME=%YY%%mm%%dd%%CURRENTHOUR%%TIME:~3,2%

I need to expand the TIME option to include the SS etc to make sure a file is created with as unique a number as possible and I cannot find a reference to show me how this command works (I want to be able to work on this myself).

Can someone POINT me to a document that explains the usage of "TIME" in this context
And/Or
Can someone expand this command for me to include the SS:NN

Thanks for all your help.
Ken%time% is the system variable that holds the current time.

You can slice a string thus

set substring1=%string:~M,N%

where M and N are numbers. M is the offset from the start of the string, the first character being 0 (zero), and N is the number of characters to slice.

So if %string% is Computer

then:

%string:0,1% is C

and

%string%:3,4% is pute

Quote

I want to be able to work on this myself

So I won't do it for you. Now you know all you need to know to process the %time% string.





Thank You, Dias....Got it.

set CURDATETIME=%yy%%mm%%dd%%CURRENTHOUR%%TIME:~3,2%%TIME:~6,2%%TIME:~9,2%


Discussion

No Comment Found