Windows equivalent of linux cksum command

前端 未结 7 1161
北荒
北荒 2020-12-12 17:51

I am looking for a way to compute crc checksum cross platform.

cksum works on Linux, AIX, HP-UX Itanium, Solaris, is there a equivalent command of linu

7条回答
  •  [愿得一人]
    2020-12-12 18:28

    In combination of answers of @Cassian and @Hllitec and from https://stackoverflow.com/a/42706309/1001717 here my solution, where I put (only!) the checksum value into a variable for further processing:

    for /f "delims=" %i in ('certutil -v -hashfile myPackage.nupkg SHA256 ^| find /i /v "sha256" ^| find /i /v "certutil"') do set myVar=%i
    

    To test the output you can add a piped echo command with the var:

    for /f "delims=" %i in ('certutil -v -hashfile myPackage.nupkg SHA256 ^| find /i /v "sha256" ^| find /i /v "certutil"') do set myVar=%i | echo %myVar%
    

    A bit off-topic, but FYI: I used this before uploading my NuGet package to Artifactory. BTW. as alternative you can use JFrog CLI, where checksum is calculated automatically.

提交回复
热议问题