【问题标题】:save my gpg file to a different directory将我的 gpg 文件保存到不同的目录
【发布时间】:2012-08-01 18:30:53
【问题描述】:

我正在研究 GPG 加密并希望将文件保存到特定目录...有人可以告诉我如何执行此操作... 我正在使用此代码

        ProcessStartInfo startInfo = new ProcessStartInfo()
        {
            WorkingDirectory = @"C:\",
            CreateNoWindow = false,
            UseShellExecute = false,
            RedirectStandardError = true,
            RedirectStandardInput = true,
            RedirectStandardOutput = true


        };

        startInfo.FileName = "gpg.exe";
        startInfo.WindowStyle = ProcessWindowStyle.Hidden;
        startInfo.Arguments = "-e -r myname config.xml";
        using (Process exeProcess = Process.Start(startInfo))
        {

            exeProcess.WaitForExit();
        }

当我这样做时,它会将其保存到 APPdata 文件夹中,有没有办法可以将其更改为某个默认文件夹?

我是否必须设置一些环境变量才能做到这一点?

请帮助我。如果我不清楚或者我错过了一些非常愚蠢的东西,请告诉我!

提前致谢

【问题讨论】:

  • 你不能简单地在输出名称前加上路径吗?
  • config.xml 不是源文件的输出名称。你能帮我把最终的加密文件保存到特定目录吗?
  • 您是否阅读了命令行上的帮助? gnupg.org/documentation/manuals/gnupg/…
  • 我试过 @Erno 但它不能与加密一起工作!
  • 您是否添加了足够的引号以便正确处理路径中的空格?

标签: c# windows gnupg


【解决方案1】:
 ProcessStartInfo startInfo = new ProcessStartInfo()
        {
            WorkingDirectory = @"C:\",
            CreateNoWindow = false,
            UseShellExecute = false,
            RedirectStandardError = true,
            RedirectStandardInput = true,
            RedirectStandardOutput = true


        };

        startInfo.FileName = "gpg.exe";
        startInfo.WindowStyle = ProcessWindowStyle.Hidden;
        startInfo.Arguments = @"-e -r myname c:\MYPATH\config.xml -o c:\MYPATH\config.xml.gpg";
        using (Process exeProcess = Process.Start(startInfo))
        {

            exeProcess.WaitForExit();
        }

【讨论】:

  • 我想将 config.xml.gpg 文件保存在特定路径中!!谢谢你的回复:)
  • 这给了我一个错误说用法:gpg [options] --encrypt [filename]..你能帮忙吗:(
  • 试试 -o 而不是 -output
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-05-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-04-21
  • 2018-02-02
  • 1970-01-01
相关资源
最近更新 更多