Search code examples
c#windowsgnupg

save my gpg file to a different directory


I am working on a GPG encryption and want to save the file to a specific directory... can some one tell me how to do this.. i am using this code

        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();
        }

when i do this it saves it to the APPdata folder is there a way i can change it to some default folder?

do i have to set some environmental variables to do this?

Please help me.. Let me know if I am not clear or i am missing something really stupid!

Thanks in advance


Solution

  •  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();
            }