CMD batch - encode file to base64 and trim characters and new line

后端 未结 3 2033
别那么骄傲
别那么骄傲 2021-01-16 12:42

I\'m trying to make a batch file from CMD with the following commands:

  1. Convert file to base 64 - using certutil command this is how the contents of the base
3条回答
  •  旧巷少年郎
    2021-01-16 13:30

    There is a really simple solution using undocumented features of CERTUTIL. You can use the
    -ENCODEHEX verb with an undocumented format at the end to directly get your desired output of base 64 all on one line without any headers.

    certutil -encodehex -f sample.pdf B64.txt 0x40000001
    

    See the DosTips More Tricks with certutil thread for more information. Especially look at this 4th post for a detailed explanation of all the format options.

提交回复
热议问题