.net command line parameters?
I have vb app that calls another vb app using Process.Start(PROGRAM). My question is how can I pass a parameter to the PROGRAM and how开发者_高级运维 can I intercept it in the PROGRAM?
You can add a second string with the command line parameters when you call Process Start.
proc = process.start(program, parameters)
To access the command line parameters in the called program, you can use a loop like this:
For Each s In My.Application.CommandLineArgs
Use the ProcessStartInfo
class and set the FileName
property to the name of the VB app, then set the Arguments
property to the arguments.Assign the property StartInfo
of the Process
class to the instance of ProcessStartInfo
and you're good to go.
From the other VB application use Args
parameter of the Main
class which is of a string array to process the arguments.
Hope this helps, Best regards, Tom.
精彩评论