so I have a project that I'm working on which is basically a GUI implementation of a CLI program. The program works like this: program.exe LINE1 LINE2 > output.txt
. In C# I have made the code to launch the program with inputs from 2 textboxes like this:
using (Process process = new Process())
{
process.StartInfo.FileName = "c:\\users\\***\\desktop\\rar.exe";
process.StartInfo.Arguments = RarName + RarType + " > C:\\users\\***\\desktop\\app2.txt";
process.Start();
}
It's purpose is to get 2 lines of texts from 2 textboxes and run them with the argument Textbox1 Textbox2 > outputfile.txt
but as I said, it does not work. When I do the exact same thing by CMD manually, it works so the program isn't broken.
I am using variables, here is the code i use to make the variables have the same value as the textboxes:
private void textBox1_TextChanged(object sender, EventArgs e)
{
RarName = textBox1.Text;
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
RarType = textBox2.Text;
}
Also at the beginning of the code, I set the variables to blank with this:
public partial class Form1 : Form
{
string RarName = "";
string RarType = "";
public Form1()
{
InitializeComponent();
}