Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug

Jun
1
0
Hi,

Currently evaluating CMDebug v27.01.24 x64 primarily for - surprise - debugging vanilla .CMD and .BAT scripts. Very powerful IDE but already ran into a few issues. Not sure if there's a setting I'm overlooking.

Found a few close matches here in the forum, but nothing that seemed to cover this exact item.

During debugging, (and only debugging) a proven section of script broke. I tracked it down to CMDebug's expansion of %DATE%. For simplicity this can be observed in the Debug -> Evaluate Command (or -> Evaluate Expression) dialog.

In Windows Command Prompt, I get
Code:
C:\> echo %DATE%
Thu 06/17/2021

In CMDebug, I get
Code:
echo %DATE%
6/17/2021

Note CMDebug's output has
- non-zero padded month
- missing day of week

Obviously, there are several alternate methods to get the needed DATE value that would effectively workaround the unanticipated behavior. However using the %DATE% variable is orders of magnitude faster than DATE /T (on the target Intel Core i7 2.5GHz system) which in this case is key as this section of script can fire several times a second. And cleaner than using a FOR /F to parse the elements of the date. More on DATE /T below.

And certainly, while debugging I can swap in alternate code, but that kind of defeats the purpose and introduces maintenance hassles. My interest in CMDebug is toi *not* have debug code sprinkled throughout while debugging.

Using the DATE /T command in Debug -> Evaluate Command, I still have problems
Code:
date /t /f1
6/17/2021

date /t /f2
Thu 17/06/2021
Note /f1 is as unexpected as %DATE% and /f2 now changes to DD/MM/YYYY instead of MM/DD/YYYY

So this really seems like a CMDebug configuration I need to tweak but I'm not finding much that speaks to this. And most of the online discussions about INI settings for TCC don't seem to apply here.

So any tips for the new user?
Thanks!

Greg
 
As far as the /f1 and /f2 issue, it appears this is more a documentation problem. If you view the help subject "TCC Date Display Formats" the 2 is for European format, which is dd/mm/yy, although there is that 4 digit year that doesn't quite fit.:oops:

If you go to your windows "date & time" settings for "short date" and change the format for the short date you can achieve the leading zero.
Code:
Fri  Jun 18, 2021 v27.01.23 [3120]

v27.01.23_$echo %date
06/18/2021

This change also affects how CMDebug displays dates. Based on the choices this will also add a leading zero to the day. Ie. 06/01/2021 vs 6/1/2021. Enjoy
 

Similar threads

Back
Top