According to MSDN:
If you did not use the
Startmethod to start a process, theStartInfoproperty does not reflect the parameters used to start the process. For example, if you useGetProcessesto get an array of processes running on the computer, theStartInfoproperty of eachProcessdoes not contain the original file name or arguments used to start the process.
Okay, that makes perfect sense. My question is why are these parameters blank even when you do use Process.Start()?
For example:
Dim startInfo As New ProcessStartInfo("firefox.exe") startInfo.Arguments = "www.stackoverflow.com" startInfo.WindowStyle = ProcessWindowStyle.Minimized Process.Start(startInfo) For Each proc As Process In Process.GetProcessesByName("firefox") Debug.Print(String.Format("ProcessID={0}; Arguments={1}", _ proc.Id, proc.StartInfo.Arguments)) Next proc
In this case even though I provided Arguments, that property is still empty.
What gives?
You are still doing a GetProcess, thus it continues to work the same. The fact that you started it doesn’t make a difference.
Process.Start(…) returns the process that you started. I expect that if you check the StartInfo property on that, it will be populated.