Some sample code:
var psi = new ProcessStartInfo();
psi.FileName = "path to update.exe";
psi.Arguments = "arguments for update.exe";
psi.Verb = "runas";
var process = new Process();
process.StartInfo = psi;
process.Start();
process.WaitForExit();
Ref: 0xA3.
Programmatically in code what type of objects if possible could you pass into the ‘.Arguments’ property? Typically you can pass an int or a string type. I want to know if you could pass in a more complicated type like a DirectoryInfo[] or a FileInfo[]? Would anyone know if this is possible? If not i’ll have to come up with something else?
Why? I am trying to remove some problem code from a very large background worker and the only solution is to pass the data I require into a process that will handle the work I need doing in a completey different process. Problem this problem code always throws up on permissions – permissions the app does not have.
Serialize the data then you can “pipe” the resulting string into the other process’s standard input. See example of “Process.StandardInput Property” help topic at http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardinput.aspx
Serialize the data, store into a file then have other process read this file, passing the path to the file in Arguments.
– Allocate the object into global memory then pass the resulting IntPtr, in Arguments, to the other process.