-2

I'm starting a process with ProcessStartInfo, the process is started but is not able to access to any directory. If I start the same process manually, everything is working normally.

var processStartInfo = new ProcessStartInfo();
processStartInfo.WindowStyle = ProcessWindowStyle.Normal;
processStartInfo.WorkingDirectory = pathFileGestioneMacchine;
processStartInfo.Arguments = "A";
processStartInfo.FileName = nomeExeAggiornaMacchine + ".EXE";
//processStartInfo.UseShellExecute = true;
processStartInfo.Verb = "runas";
Process procStart = new System.Diagnostics.Process();
procStart.StartInfo = processStartInfo;
procStart.Start();
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
  • Try starting VS by clicking shortcut and selecting Run As admin. Running your executable from outside VS you will automatically have access to file system. Also any exe file you must include full pathname if the exe is not in same folder as your c# application. – jdweng Aug 09 '22 at 09:13
  • 2
    "is not able to access to any directory" - what does this exactly mean? Which kind of access? Which directory/directories specfifcally? – Klaus Gütter Aug 09 '22 at 09:18

1 Answers1

0

Open Visual Studio with admin privilegies. For start a proccess you need to be admin.

Belen Martin
  • 507
  • 5
  • 7