How could I change Root Directory with command

I try to use LetsEncrypt Certificates , it’s works and with this command I able to provide LetsEncrypt.

string command= String.Format(staging + "-a -j -d {0} -p {1} {2}", "domain.com", certPassword, options);
			Process p = Helpers.LaunchProcess(@"acme.net\acme.exe", command,
				stdout => this.Invoke(() => tbLog.AppendText(stdout + CRLF)),
				stderr => this.Invoke(() => tbLog.AppendText(stderr + CRLF)));

On Command Prompt we have a command like “cd c:\domain1” to change Root Directory in DOS, is there any thing like this to change Root of acme.exe?
I asking for such a thing because for now, I should to copy my .exe file to Root of each domain.

Code of LaunchProcess:

public static Process LaunchProcess(string processName, string arguments, Action<string> onOutput, Action<string> onError = null)
		{
			Process p = new Process();
			p.StartInfo.UseShellExecute = false;
			p.StartInfo.RedirectStandardOutput = true;
			p.StartInfo.RedirectStandardError = true;
			p.StartInfo.RedirectStandardInput = true;
			p.StartInfo.FileName = processName;
			p.StartInfo.Arguments = arguments;
			p.StartInfo.CreateNoWindow = true;
			p.OutputDataReceived += (sndr, args) => { if (args.Data != null) onOutput(args.Data); };
			if (onError != null)
			{
				p.ErrorDataReceived += (sndr, args) => { if (args.Data != null) onError(args.Data); };
			}
			p.Start();
			// Interestingly, this has to be called after Start().
			p.EnableRaisingEvents = true;
			p.BeginOutputReadLine();
			p.BeginErrorReadLine();
			return p;
		}

I’m not too familiar with Windows development, but in most operating systems, you can define a “current working directory” when you launch a new process.

In .NET Core, this appears to be ProcessStartInfo.WorkingDirectory.

In your example, I think you would pass the absolute path to your single copy of acme.exe to processName, and then you would add another argument for the CWD and pass it to p.StartInfo.WorkingDirectory.

1 Like

I try to use "p.StartInfo.WorkingDirectory", seems it's what I need, but after that I faced with error that I wasn't faced before because I'm using "ACMEv2":

Account creation on ACMEv1 is disabled. Please upgrade your ACME client to a version that supports ACMEv2 / RFC 8555. See End of Life Plan for ACMEv1 for details.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.