0

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 ????

Mohammad AL-Rawabdeh
  • 1,592
  • 12
  • 30
  • 54

1 Answers1

3

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

Bart De Vos
  • 17,761
  • 6
  • 62
  • 81