I want to open the document with wordpad.exe but it is still opening with microsoft word
I currently have:
string fullPath = helpFiles[index];
ProcessStartInfo psi = new ProcessStartInfo("wordpad.exe");
psi.FileName = Path.GetFileName(fullPath);
psi.WorkingDirectory = Path.GetDirectoryName(fullPath);
psi.Arguments = fullPath;
Process.Start(psi);
I asume
fullPathis your document's name. You're setting theFileNameproperty to the document which means it'll open in the default document editor (Word in this case).The overload of
ProcessStartInfoyou're using sets the filename for you but you're replacing that value withPath.GetFileName(fullPath);which is whywordpad.exeis completely ignored. Set theFileNameaswordpadand theargumentsas your file path (i.e remove your FilePath line).