|
Answer» Hi all.
I need help creating a batch that will, on an XP system;
1. GET the current time 2. determine if time is in 12 or 24 hour format 3. convert to 24 hour format if needed 4. enter the current time + 1 minute into a command line; eg, if it's now 8:54 PM, the time entered into the command would be 20:55
get current time determine format convert to 24 hr where needed add 1 minute to the current time of 20:54 at 20:55 START notepad
TIAwww.homeworkhope.comThanks GX1_Man, but that URL won't resolve for me. Me either. I know if you put %time% into the bat file it will show the time. Don't know about the rest.Unless you're prepared to write a boatload of IF statements, batch code is not the best solution. Try using any of the Windows scripting languages (VBScript, JScript, Perl, Rexx, Python etc) which have functions for processing DATES and times.
The Windows 2000 Scripting Guide may help get you started.
Good luck. 8-)Thanks Sidewinder,
I actually found a utility called Errtime that will return hours in 12 or 24 ERRORLEVELS, and minutes in 0-59 errorlevels. Using that and the following format, I was able to get the job done.
errtime -h if errorlevel 23 goto hour23 etc etc through to errorlevel 0
:hour23 errtime -M if errorlevel 59 set (a=00) else (set a=23) goto minutes etc etc through to errorlevel 0
:minutes errtime -M if errorlevel 59 (set b=00)& goto done if errorlevel 58 (set b=59)& goto done etc etc through to errorlevel 0
:done at %a%:%b% notepad
Does involve a few IF statements, but not a problem. Javascript would be quite an easy way to go about this one!!
|