We help IT Professionals succeed at work.

pass paramters while executing vbscript from c sharp

eagle_ea
eagle_ea used Ask the Experts™
on
hello
i'm calling a vbscript from c sharp using the below command,
 System.Diagnostics.Process.Start("test.vbs")
is there an option to pass a parameter from csharp to vbscript in the aboce command.
also, retrieve the value in the vbscript?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
I believe this looks like:

System.Diagnostics.Process.Start("test.vbs", "args")

where args are the command line parms you want to pass, just like you could have entered from a command line.

~bp

Author

Commented:
how to get the value in the vbscript?
Test your restores, not your backups...
Top Expert 2016
Commented:
Ah sorry, should have seen that part of the question.  A good write up on it here, talking about positional versus named parms.

http://technet.microsoft.com/en-us/library/ee156618.aspx

For positional you can just reference them in the VBS similar to this example:

Set oArgs = WScript.Arguments
sInputFile = oArgs.Item(0)
sOutputFile = oArgs.Item(1)

Open in new window

~bp