How to use the @sha1 function in a tcc.exe command line?

Jul 18, 2009
30
0
I'm new to tcc.exe and am trying to download and run vim
so I can edit batch files.

Before running vim it is necessary to use the @sha1 function
to make sure my download is correct.

I'd like to use a command line like:
c:\users\lba\downloads %[[@sha1] vim73-x64.zip]
to use the @sha1 function to display the sha1 variable.

It's not working so that means I'm not using the syntax properly.

Could anyone tell me the proper syntax?

Larry Alkoff
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,491
90
Albuquerque, NM
prospero.unm.edu
I'm new to tcc.exe and am trying to download and run vim
so I can edit batch files.

Before running vim it is necessary to use the @sha1 function
to make sure my download is correct.

I'd like to use a command line like:
c:\users\lba\downloads %[[@sha1] vim73-x64.zip]
to use the @sha1 function to display the sha1 variable.

It's not working so that means I'm not using the syntax properly.

Could anyone tell me the proper syntax?

You can use functions like @SHA1 in any command, even an external command. If you just want to see the checksum, then ECHO would be an appropriate command:

Code:
echo %@sha1[c:\users\lba\downloads\vim73-x64.zip]
 
Jul 18, 2009
30
0
You can use functions like @SHA1 in any command, even an external command. If you just want to see the checksum, then ECHO would be an appropriate command:

Code:
echo %@sha1[c:\users\lba\downloads\vim73-x64.zip]

Thank you very much Charles.
This will apply to any function, so now I know how to handle functions

Larry
 
D

drrob1

Guest
This is a batch file I call sha1bat.btm. It lets me pick the file I
want the sum computed on, and compares it to a text file that already
has that value computed so I can compare.

echo filename and hash are on same line
setlocal
: bdebugger
set filespec=%@getfile[.]

: you will need to be in the same folder as this file
:: assuming from your post the filename and hashvalue are on the
same line
:: word0 will be the iso filename, word1 will be the hash value

do r=0 to %@lines[%filespec]
set aline=%@line[%filespec,%r]
set sha1hash=%@sha1[%@word[0,%aline]]
IFF %sha1hash EQ %@word[1,%aline] THEN
echo Matched
ELSE
echo Not Matched
ENDIFF
enddo
endlocal

On 12/11/2010 06:40 PM, larryalk wrote:

> ---Quote (Originally by Charles Dye)---
> You can use functions like @SHA1 in any command, even an external command. If you just want to see the checksum, then ECHO would be an appropriate command:
>
>
> Code:
> ---------
> echo %@sha1[c:\users\lba\downloads\vim73-x64.zip]
> ---------
> ---End Quote---
> Thank you very much Charles.
> This will apply to any function, so now I know how to handle functions
>
> Larry
>
>
>
>
>
 
Jul 18, 2009
30
0
This is a batch file I call sha1bat.btm. It lets me pick the file I
want the sum computed on, and compares it to a text file that already
has that value computed so I can compare.

echo filename and hash are on same line
setlocal
: bdebugger
set filespec=%@getfile[.]

: you will need to be in the same folder as this file
:: assuming from your post the filename and hashvalue are on the
same line
:: word0 will be the iso filename, word1 will be the hash value

do r=0 to %@lines[%filespec]
set aline=%@line[%filespec,%r]
set sha1hash=%@sha1[%@word[0,%aline]]
IFF %sha1hash EQ %@word[1,%aline] THEN
echo Matched
ELSE
echo Not Matched
ENDIFF
enddo
endlocal

On 12/11/2010 06:40 PM, larryalk wrote:

Thanks for the batch file drrob1.
I'm probably going to have to go over my old batch files
from 10-15 years ago when I used Windows and 4NT
and can use yours as a model.

Larry
 
Similar threads
Thread starter Title Forum Replies Date
fpefpe sha1 builtin Support 8
T Fixed Function @timer[] does not work as required Support 6
vefatica Documentation Function parameters Support 0
Jay Sage Documentation Function @DRIVE Missing in Help Lists Support 0
Joe Caverly How to? Get name of current LIBRARY function? Support 4
x13 WeekNum function? Support 3
Joe Caverly No blank line in TEXT...ENDTEXT in a LIBRARY function Support 8
cgunhouse Ctrl-C from within a library function Support 6
C email[string] function Support 10
R FUNCTION to count NUMBER of files matching a pattern and specific length/not length Support 4
Dick Johnson Using the @instr function Support 5
vefatica '}' in a library function? Support 3
D Can the argument to RETURN be a function expansion? Support 3
J Trouble with @full[] function. Support 3
Fross Quick Function Question Support 17
vefatica Quoting @Function parameters? Support 0
Joe Caverly Debugging a LIBRARY function Support 10
Steve Pitts Documentation @CAPI function summary Support 0
x13 %x$ in function Support 3
thorntonpg @eval function, interesting results any explanation? Support 3
x13 Function to get interface user-defined name? Support 10
vefatica Fixed Help @FUNCTION, missing paragraph Support 8
Mordachai Variable followed by function constantly failing... Support 5
nickles Call a complex function Support 13
M Fixed Cannot use the "Browse..." function in "Find files/text" dialogbox Support 2
R Function #IDOW returns only 2 characters Support 10
T scrput `` in alias or function Support 2
S International characters - TYPE vs %@LINE function Support 5
JohnQSmith WAD @REPEAT function Support 15
vefatica WAD Nested variable expansion in PDIR's @function[*]? Support 13
R In addition to ALIAS /Z and FUNCTION /Z, HISTORY /Z? Support 1
A pdir function usage Support 3
nikbackm FUNCTION with variable number of arguments Support 17
S %@REGQUERY function Support 1
Dan Glynhampton Documentation v15 help: Error on @TRIMALL function page Support 0
M Why doesn't this @Field function work? Support 0
fpefpe How to? user function Support 1
M Why is this function getting these results in these circumstances? Support 6
A WAD function return values with parentheses prevent evaluation of additional functions Support 31
M Just an out-of-curiosity question the List command vs. the @Lines function... Support 13
M How to? Just verification for what I think I know regarding "Function"... Support 4
Frank How to? need help with "function" Support 10
Joe Caverly How to? Function Key With INPUT Support 5
M How to? "Function" and "%[xxx]" Support 7
M Kind of a out-of-curiosity question re. the "Function" command... Support 5
M Simple question about "Function" command... Support 4
M Just a curiosity question related to the "Function" command... Support 2
C not sure of windows registry function use Support 2
Phileosophos The @urlencode function doesn't seem to URL encode Support 16
J issue to have "if" inside function Support 3

Similar threads