main []args parameter to run another instance
-
i have application that open word document when the user open the applicatoin and try to open another document from the application, the application starts new instance by shell command and passes the file name as parameter. the problem is i always get the message "can not find the file specified" but when i deguged the application and copyed the command string and tryed to ru it from the prompet it worked well. here is my code::: ///////////////////////////////////////////////////////////////////////////////////// string action=""; System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents=false; string path = Environment.CurrentDirectory; int pos=ienum.Current.ToString().IndexOf("bin");//get the first parameter action=path+"\\Almogahed.exe "+ienum.Current.ToString().Substring pos+12); ienum.MoveNext(); action+=" "+ienum.Current.ToString().Substring(pos+12);//get second parameter proc.StartInfo.FileName=action; proc.Start(); // file can not found why!!!!!!!!!!!!! /////////////////////////////////////////////////////////////////////////////////////
-
i have application that open word document when the user open the applicatoin and try to open another document from the application, the application starts new instance by shell command and passes the file name as parameter. the problem is i always get the message "can not find the file specified" but when i deguged the application and copyed the command string and tryed to ru it from the prompet it worked well. here is my code::: ///////////////////////////////////////////////////////////////////////////////////// string action=""; System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents=false; string path = Environment.CurrentDirectory; int pos=ienum.Current.ToString().IndexOf("bin");//get the first parameter action=path+"\\Almogahed.exe "+ienum.Current.ToString().Substring pos+12); ienum.MoveNext(); action+=" "+ienum.Current.ToString().Substring(pos+12);//get second parameter proc.StartInfo.FileName=action; proc.Start(); // file can not found why!!!!!!!!!!!!! /////////////////////////////////////////////////////////////////////////////////////
thank u i did it by using ///////////////////////////////// proc.StartInfo.Arguments=param; /////////////////////////////////