
Passing values to variables in a .vbs file
The
VBScript code could be (a file called myscript.vbs):
If Wscript.Arguments.Count < 2 Then
Msgbox "Error"
Wscript.Quit(1)
End If
SourceFile = Wscript.Arguments(0)
OutputFile = Wscript.Arguments(1)
At the command prompt, if you enter
cscript
myscript.vbs "c:\windows\myfile.txt" "c:\temp\output.txt"
then SourceFile will be "c:\windows\myfile.txt"
and OutputFile will be "c:\temp\output.txt"
Richard
Quote:
>-----Original Message-----
>I want to run a .vbs file from the command prompt. The
>code in the .vbs file is as follows :
>Dim o
>Set o = CreateObject("myObject")
>o.SourceFile =
>o.OutputFile =
>o.Run
>While putting in the name of the.vbs file at command
>prompt, I also want to specify names with paths of files
>(as parameters), which should be passed onto the .vbs to
>set values of the variables o.SourceFile & o.OutputFile.
>What is the right syntax for achieving the above - both
as
>regards the command prompt and also what code do i need
to
>add in the .vbs file.
>.