Search code examples
c#acme

How to pass arguments to command line utility using c#?


I'm writing an application, and at one point it launches win-acme and needs to pass some parametres to it. I'm successfully opening powershell and launching win-acme, but it doesn't pass arguments to it. So, I have this code:

Process wacsProcess = Process.Start(new ProcessStartInfo
    {
        FileName = @"C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe",
        Arguments = (@"cd C:\inetpub\letsencrypt ; .\wacs.exe ; N"),
        RedirectStandardOutput = true,
        UseShellExecute = false,
        WindowStyle = ProcessWindowStyle.Hidden
   });

File.WriteAllText(".\\OutPutAfterFirstLaunch.txt", 
    wacsProcess.StandardOutput.ReadToEnd());

It opens command-line utility, but doesn't give it the last parametr "N". I guess that is because I'm passing this parametr to the powershell, but it's still working with win-acme. It looks like this:

enter image description here

Is there a way to pass an argument to the command line utility using C#?


Solution

  • This is how this application is designed. It is meant to be interactive for new certificates. Please see the documentation with all of the allowed command-line arguments: https://www.win-acme.com/reference/cli