i've been trying to open a text file from my system after computing pearson correlation and writing the result on a text file but so far for some reason the code doesn't open any notepad files i've tried opening other files and they work fine but .txt files are not opening specifically, even .docx files are opening using the same code! if anyone could please tell me if there is any specific reason for this! here is the line i'm writing in my code using process.start()
System.Diagnostics.Process.Start(@"C:\Users\Atif\Desktop\1.txt");
or
System.Diagnostics.Process.Start(Directory.GetCurrentDirectory()+"\\1.txt");
i think there's something wrong with my PC i just tried the same code on another machine and it is working! but i still don't understand what could be the problem apart from this program the notepad is working fine!
if you want to use Notepad to open the file and it is not the default text editor you can use like following:
Process.Start("notepad.exe", @"C:\Users\Atif\Desktop\1.txt");
I know this is old, but I had a similar issue with .Net 7.0 (worked in .Net 4.8.1)... I had to use:
ProcessStartInfo psi = new ProcessStartInfo(Filename);
psi.Verb = "open";
psi.UseShellExecute = true;
Process.Start(psi);
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