roock89
roock89
CC#
Created by roock89 on 2/26/2025 in #help
Not getting the .txt output after running a process
Im trying to log all the text that is output from a program into a txt file, but after its run successfully it does not seem to generate the .txt file as specified, if it is generated i dont know where it is ending up. Im running the process like this:
string command = "info {0} -p {1} >> {2}_Pdal_PointLog.txt";
command = string.Format(command, path, pointCount-1, folderPath+filename);
//Execute the command
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = exePath,
Arguments = command,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
};

process.StartInfo = startInfo;
process.Start();
string command = "info {0} -p {1} >> {2}_Pdal_PointLog.txt";
command = string.Format(command, path, pointCount-1, folderPath+filename);
//Execute the command
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = exePath,
Arguments = command,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
};

process.StartInfo = startInfo;
process.Start();
the entire program is completing and exiting, the process is outputting the correct data im requesting with the command, but as said there is no .txt file in the specified location (it should be in the same folder as the input file). its as if its entirely ignoring the >> {2}_Pdal_PointLog.txt section of the command. I have also double checked that the .txt path is correct as im logging the final command so i can see it. i have both tried using the .exe i need directly and cmd then calling the .exe with arguments from that but that does not seem to make a difference.
9 replies