Tag: 密钥库

使用C#中的参数执行命令行.exe

我正在尝试使用C#中的参数执行命令行程序。 我本以为,在C#中站起来并实现这一目标将是微不足道的,但即使使用本网站及其他网站上提供的所有资源,它也具有挑战性。 我很茫然,所以我会提供尽可能详细的信息。 我当前的方法和代码在下面,在调试器中变量命令具有以下值。 command = “C:\\Folder1\\Interfaces\\Folder2\\Common\\JREbin\\keytool.exe -import -noprompt -trustcacerts -alias myserver.us.goodstuff.world -file C:\\SSL_CERT.cer -storepass changeit -keystore keystore.jks” 问题可能是我如何调用和格式化我在该变量命令中使用的字符串。 关于可能出现什么问题的任何想法? ProcessStartInfo procStartInfo = new ProcessStartInfo(“cmd”, “/c ” + command); procStartInfo.RedirectStandardOutput = true; procStartInfo.UseShellExecute = false; procStartInfo.CreateNoWindow = true; Process process = new Process(); process.StartInfo = procStartInfo; process.Start(); string result = process.StandardOutput.ReadToEnd(); Console.WriteLine(result); 一旦完成,我就不会在变量结果中找回任何信息或错误。