Capture EXE output in PowerShell

前端 未结 5 2072
野趣味
野趣味 2020-12-09 02:40

A little background first.

I\'ve been tasked with encrypting files with a Powershell script using GPG (gnupg.org). The specific exe I\'m calling is simply gpg.exe. I

5条回答
  •  情歌与酒
    2020-12-09 02:53

    Does the output you're expecting go to standard-error or standard-out?

    does this work?

    & $gpgLocation --import "key.txt" 2>&1 | out-file gpgout.txt
    

提交回复
热议问题