Home / Microsoft / Microsoft DOS / Using SET and time in batch file, want to get the difference in time
0 Members and 3 Guests are viewing this topic. « previous next »
Pages: 1 [2]  All - (Bottom) Print
Author Topic: Using SET and time in batch file, want to get the difference in time  (Read 8364 times)
levidos
Newbie



Posts: 1

Experience: Beginner
OS: Unknown

« Reply #15 on: March 11, 2011, 09:47:53 AM »

Check out this ultimate script that queries system time through WMI.
Link Removed...[/i]
« Last Edit: February 02, 2012, 06:25:12 PM by patio » IP logged
Migxi
Newbie



Posts: 2

Experience: Beginner
OS: Unknown

« Reply #16 on: February 02, 2012, 06:15:33 PM »

Beware of the confusion Octal/Decimal if the variable is 08 or 09

So modification needed...

set T1=%TIME%
echo Start time= %T1%
set HH=%T1:~0,2%
set MM=%T1:~3,2%
set SS=%T1:~6,2%
Rem To remove confusion Octal/Decinal with 08 and 09
IF %T1:~0,1%==0 set HH=%T1:~1,1%
IF %T1:~3,1%==0 set MM=%T1:~4,1%
IF %T1:~6,1%==0 set SS=%T1:~7,1%

Envoy
IP logged
Squashman
Hopeful



Thanked: 25
Posts: 345

Experience: Experienced
OS: Other



« Reply #17 on: February 02, 2012, 08:04:52 PM »

Beware of the confusion Octal/Decimal if the variable is 08 or 09
Love it when people dig up old threads.
Your statement is clearly defined in the help for the SET command.
Quote
Numeric values are decimal numbers, unless
prefixed by 0x for hexadecimal numbers, and 0 for octal numbers.
So 0x12 is the same as 18 is the same as 022. Please note that the octal
notation can be confusing: 08 and 09 are not valid numbers because 8 and
9 are not valid octal digits.
IP logged
Pages: 1 [2]  All - (Top) Print 
Home / Microsoft / Microsoft DOS / Using SET and time in batch file, want to get the difference in time « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.086 seconds with 19 queries.