PDA

Click to See Complete Forum and Search --> : Calling process! **SOLVED**


Sgt-Peppa
Nov 18th, 2003, 10:26 AM
Hey all,

I have a smal prob and I am really hoping someone knows an answer to it.

So heres what I do, I have a small app which needs to call a tool called gacutil. I do that using following code:


doRegsvcs.StartInfo.FileName = txtNetDir.Text + @"\\Primary Interop Assemblies\\gacutil";
doRegsvcs.StartInfo.Arguments= "/i " + txtNetDir.Text + @"\Primary Interop Assemblies\adodb.dll";
doRegsvcs.StartInfo.UseShellExecute = false;
doRegsvcs.EnableRaisingEvents = false;
doRegsvcs.StartInfo.RedirectStandardOutput = true;
doRegsvcs.StartInfo.CreateNoWindow = true;
doRegsvcs.Start();
finalStatus = finalStatus + doRegsvcs.StandardOutput.ReadToEnd().ToString();
doRegsvcs.WaitForExit();
doRegsvcs.Close();


So calling the app works,...but with one Problem:

the tool I am calling is saying that the function gacutil /i only takes one argument. Well as you can see I am only passing one argument. I figure that this tool I am calling is not supporting whitespaces in the Folder Names! So how can I get this tool to work? Is it possible to change to the directory and then perform the tool? Or does anyone know some sort of workaround?

Hope that makes sense, thanks in advance,

Stephan

hellswraith
Nov 18th, 2003, 04:33 PM
Yes, I had the same problem when trying to start a word document through a command line argument. You are right, the white space is causing the problem because it is thinking the arguments are seperated by white space.

You need to include quotes around it.
Do something like this:


string dir = @"C:\Root";
MessageBox.Show("/i \"" + dir + "\\Primary Interop Assemblies\\adodb.dll\"");

Sgt-Peppa
Nov 19th, 2003, 03:09 AM
That does the trick, thanks a lot, saved me a lot of time!

Thanks again,

Stephan