I have a winforms application in C# where I have to open a certain Folder. I use
System.Diagnostics.Process.Start(pathToFolder);
This results in the following exception:
System.ComponentModel.Win32Exception (0x80004005): Access is denied
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at MyApp.openLogFolderToolStripMenuItem_Click(Object sender, EventArgs e)
I have already checked the following things:
- The folder exists
- The user has rights to the folder (can open it in Explorer)
Another thing is that if I use Process.Start()
to open a file inside this folder, it works.
Can anyone give me a hint?
Cheers
Edit
My goal is to open the folder in Explorer.
The pathToFolder
is something like H:\Something\App.Name\Log