Hello,
I am trying to pass file path as command line argument. If the path without spaces it works fine. with spaces it is not.
Please find my code below.
string scriptFilePath = "@" + Directory.GetCurrentDirectory() + "\\" + scriptFile; // exact path
string scriptPath= " \"" + scriptFilePath + "\""
string file1 = "D:\New Folder\file1.png";
string file2 = "D:\New Folder\file2.png";
string outPutPath = "D:\New Folder\Output\Report.html";
string commandText = "executable.exe" + scriptPath + " " + "\"" + file1 + "\"" +" " + "\"" + file2 + "\"" + " " + "\"" + outPutPath + "\""
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WorkingDirectory = @exePath;
startInfo.FileName = "cmd.exe";
startInfo.RedirectStandardInput = true;
startInfo.UseShellExecute = false;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
startInfo.Arguments = commandText;
try
{
proc = Process.Start(startInfo);
return true;
}
catch (Exception ex)
{
return false;
}
Please help me out if am missing anything.
Thanks.