Adrian Albu

Adrian Albu

  • NA
  • 11
  • 0

shell execute gives failed to initialize error

Nov 27 2009 2:41 AM
Hi,

here is my code:

                    Process proc = new Process();

                    proc.StartInfo.UseShellExecute = true;

                    proc.StartInfo.FileName = @"C:\robocopy.exe";

                   String temp = (fi.FullName).ToString();          

                   temp = temp.Replace("\\" + fi.Name,"");

                   proc.StartInfo.Arguments = temp + " " + target.ToString() + " " + fi.Name;                 

                   proc.Start();


Everything works well WITH showing every copy process in shell/cmd window. If I set the proc.StartInfo.UseShellExecute = false; or

proc.StartInfo.CreateNoWindow = true; or both the files are copied, although don't know if all (hundreds of GBs) but I got warning/errors pop ups:

application failed to initialize ...

My try was to change the registry key Windows, from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems\system32\csrss.exe, value to %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,20480,768 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16

(see: http://aceshardware.freeforums.org/i-think-i-ve-uncovered-a-major-issue-in-windows-t458.html)

but I still got it.

If somebody has an idea i will apreciate it.


Regards,

Adrian



Answers (7)