- Aug
- 258
- 4
Hi,
I'm doing some considerations for a script to create a fileage-report.
In preparation for this I'm using variables beginning with the $-sign, which should be allowed
as the help says "The environment variable names you use this way may contain any alphabetic or numeric characters, the underscore character _, and the dollar sign $"
But I have a funny behavior: when I issue the commands at the prompt, they are ok
and if I run them as a btm they do not work.
Neither "SET /A" nor "@EVAL" can handle the $variables.
Am I on the wrong track?
I'm doing some considerations for a script to create a fileage-report.
In preparation for this I'm using variables beginning with the $-sign, which should be allowed
as the help says "The environment variable names you use this way may contain any alphabetic or numeric characters, the underscore character _, and the dollar sign $"
But I have a funny behavior: when I issue the commands at the prompt, they are ok
Code:
C:\Program Files\JPSoft\TCMD13x64 >ver
TCC 13.04.63 x64 Windows 7 [Version 6.1.7601]
C:\Program Files\JPSoft\TCMD13x64 >plugin
TCC: No plugins loaded
C:\Program Files\JPSoft\TCMD13x64 >set $yearsback=10
C:\Program Files\JPSoft\TCMD13x64 >set $lastindex=%@eval[%$yearsback + 1]
C:\Program Files\JPSoft\TCMD13x64 >set /a $nelements=%$yearsback + 2
12
C:\Program Files\JPSoft\TCMD13x64 >set /a $baseyear=%_year - %$yearsback
2002
C:\Program Files\JPSoft\TCMD13x64 >
C:\Program Files\JPSoft\TCMD13x64 >set $*
$baseyear=2002
$lastindex=11
$nelements=12
$yearsback=10
C:\Program Files\JPSoft\TCMD13x64 >
C:\Program Files\JPSoft\TCMD13x64 >unsetarray /q array
C:\Program Files\JPSoft\TCMD13x64 >setarray array[%$nelements]
C:\Program Files\JPSoft\TCMD13x64 >echo %@arrayinfo[array,0]
1
C:\Program Files\JPSoft\TCMD13x64 >echo %@arrayinfo[array,5]
12
Code:
C:\Program Files\JPSoft\TCMD13x64 >filecount_per_year.btm
echo on
setlocal
on break goto end
rem The environment variable names you use this way may contain any alphabetic or numeric characters,
rem the underscore character _, and the dollar sign $
set $yearsback=10
set $lastindex=1
set /a $nelements=yearsback + 2
set /a $baseyear=2012 - yearsback
set $*
$baseyear=2012
$lastindex=1
$nelements=2
$yearsback=10
unsetarray /q array
setarray array[nelements]
C:\Program Files\JPSoft\TCMD13x64\filecount_per_year.btm [16] Usage : SETARRAY name[a[,b[,c[,c]]]] [...]
echo 1
1
echo 0
0
endlocal
quit
Neither "SET /A" nor "@EVAL" can handle the $variables.
Am I on the wrong track?