第一,背景不多。
我的任务是使用全球公益物(gnupg.org)将档案与Powerhell书写。 具体的“Im”呼吁只是gpg.exe。 每当我执行指挥时,我就掌握产出。
例如,我在权力领域进口了以下公用钥匙:
& $gpgLocation --import "key.txt"
美元gpgLocation只是gpg.exe(亏损为“C:Program filesGNUGnuPGgpgpg.exe”)的档案地点。
我在此提出的整个问题是,如果我尝试:
& $gpgLocation --import "key.txt" | out-file gpgout.txt
我获得的所有文件都是一刀切的,名称是适当的,但是COMLETELY空白。 我曾尝试过几条旗帜,以便看一下我是否走进了车库。
我也试图将指挥权送交这部法典(并用通常的档案记录等记录产出):
param
(
[string] $processname,
[string] $arguments
)
$processStartInfo = New-Object System.Diagnostics.ProcessStartInfo;
$processStartInfo.FileName = $processname;
$processStartInfo.WorkingDirectory = (Get-Location).Path;
if($arguments) { $processStartInfo.Arguments = $arguments }
$processStartInfo.UseShellExecute = $false;
$processStartInfo.RedirectStandardOutput = $true;
$process = [System.Diagnostics.Process]::Start($processStartInfo);
$process.WaitForExit();
$process.StandardOutput.ReadToEnd();
任何想法? 我!