I have a program test.exe that receives arguments and writes some logs in a specific .txt path that I give as an input. I wanted to add this command:
text.exe /r >> textFile.txt
meaning : build the project and write the logs to the textFile.txt (that doesn't exist)
I'm not sure how it works? is args[2] = ">>" and args[3] = textFile.txt ?
how can I use the name of it??
confused!
editing :
when I'm debugging and looking at the locals I see only /r but the >> textFile.txt doesn't appear at all.
how can I get it fro the command line as a pararmeter?
edit2 :
Understood that it should re-direct automatically, but when I'm doing it it just fails and sends me to a line : Console.CursorLeft = 0; meaning i'm trying to do somethong with the cursor when I don't have a console... just .txt
thanks!
No, the command shell will only pass /r to test.exe, and it will automatically redirect output to append to textFile.txt. Your app doesn't get to see that - at least not simply.
If you just make your program write to the standard output (e.g. with Console.WriteLine) that output will end up in textFile.txt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With