We help IT Professionals succeed at work.

pass paramters while executing vbscript from c sharp

eagle_ea used Ask the Experts™
i'm calling a vbscript from c sharp using the below command,
is there an option to pass a parameter from csharp to vbscript in the aboce command.
also, retrieve the value in the vbscript?
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

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.



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


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