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
fullPath
is your document's name. You're setting theFileName
property to the document which means it'll open in the default document editor (Word in this case).The overload of
ProcessStartInfo
you're using sets the filename for you but you're replacing that value withPath.GetFileName(fullPath);
which is whywordpad.exe
is completely ignored. Set theFileName
aswordpad
and thearguments
as your file path (i.e remove your FilePath line).