echo wscript.echo right(year(CDate(wscript.arguments(0))),2) > temp.vbs
start temp.vbs
it will echo the last two digits of the year. Note that the provided date will need to be in a format recognized by the current system locale; mine for example is mm/dd/yyyy. Also, it crashes if no arguments are provided with subscript out of range (not surprising).
I cant remember the for command used to redirect output of a command into a environment variable, but I'm sure that would work here.
@Reno: I don't think anybody really had an issue with the debug script, just that it's a bit much
Also- you can open a VBScript and read it- that isn't possible with an assembled COM file.
And another problem is that Debug, I believe creates a Tiny Memory model 16-bit Dos executable, which won't run on a 64-bit machine
of course as a solution for pure DOS which doesn't have VBScript installed, (and also assuming it's a MS-DOS distribution as opposed to PC-DOS which included REXX) then it's a workable solution.
I think this thread is pointless! WHO CARES ABOUT THE LAST DIGITS OF THE YEAR! just do this.
echo %date:-~4%
I don't think you will need this program in 7991 years (when they add another digit to the date).
Not exactly portable to different locales. my %DATE% variable is:
Thu 03/12/2009
hmm, start at the fourth character...
03/12/2009
and we get the entire date; so I'm confused as to what this accomplishes.
Also, I might add it doesn't even do that, it just echos "date:-~4".
Not sure exactly how that would work anyway, since even if the format was, for example yyyy/mm/dd, then it would just grab the entire date, not counting the weekday.