i use checksum command in my batch file and the output of command as follow :

69514a29dc44cd83b42658e917ed9baf *file.txt

i want to return checksum only so i should store it in variable without file.txt like

CHECKSUM=69514a29dc44cd83b42658e917ed9baf

how i can do this maybe write output of command to file then read this file ??? if yes how i can read just first 32 bits from file and store it in variable ????

link|improve this question

feedback

1 Answer

up vote 3 down vote accepted

You can use a sort of 'left'-function in batch:

set str=69514a29dc44cd83b42658e917ed9baf *file.txt
echo.%str%
set str=%str:~0,32%
echo.%str%

More info on string manipulation in dos/batch: Link

link|improve this answer
but if i want to store result from command itself how i can do this i try to do set str=checksum file.txt but not work – Mohammad AL-Rawabdeh Mar 10 '11 at 11:57
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.