我的问题是当命令行运行时它不会在我的解密文本文件中添加任何内容。我在decrypt.txt 文件中添加了文本,以查看它是否写入了它,因为文本被删除了。
System.Diagnostics.ProcessStartInfo psi =
new System.Diagnostics.ProcessStartInfo("cmd.exe");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.WorkingDirectory = "c:\\";
System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);
string sCommandLine = "echo femme toxin sorghum| gpg.exe --batch --passphrase-fd 0 --decrypt E:\\entemp.txt > E:\\detemp.txt";
process.StandardInput.WriteLine(sCommandLine);
process.StandardInput.Flush();
process.StandardInput.Close();
process.WaitForExit();
process.Close();