3

I'm encoding files with following command:

certutil -encode inputFileName encodedOutputFileName

However, this creates a new file on the system. Is it possible to print encoded data on command line and not write to a new file?

phuclv
  • 26,555
  • 15
  • 113
  • 235
kalsanam99
  • 31
  • 1
  • 2
  • 1
    `certutil -encode -help` says that an output file name is mandatory. However, you could show its content using `type encodedOutputFileName`. – JosefZ Dec 05 '17 at 19:05

1 Answers1

0

Use PowerShell instead

[Convert]::ToBase64String([IO.File]::ReadAllBytes("path\to\file"))

If future PowerShell versions support process substitution like bash (or you have bash on your system) then you can use something like this

certutil -encode inputFile >(/dev/tty)

Currently there may be some workaround to achieve the same purpose. But why do that when both PowerShell and bash already have tools to encode/decode base64 contents?

phuclv
  • 26,555
  • 15
  • 113
  • 235