batch or vb script with parameter from command line
I want to create a script that will execute a program that takes parameters.
This script needs to be executed from the win command line passing the parameter that will be used inside
ie:> c:\runvb.vbs parameter or c:\runbat.bat parameter
then inside, say for example the VB script (runvb.vbs)
'Create the object
Set WshShell = WScript.CreateObject("WScript.Shell")
'Execute the Windows command
ReturnCode = WshShell.Run("c:\exec.exe -p'parameter' ", 1, True)
or however it would be done either using a batch or vbs or some executable
Any Ideas???
Sorry!!
I put this in the wrong forum, could the moderator please move it??
Dim ArgObj, var1,cmd,var2
Set ArgObj = WScript.Arguments
Set WshShell = WScript.CreateObject("WScript.Shell")
var1 = ArgObj(0)
var2 = ArgObj(1)
if var1 = 1 then
cmd = "C:\cssmtp.exe -r"& var2 "
else
cmd = "C:\cssmtp.exe -r"& var2 & " otherstuff"
end if
ReturnCode = WshShell.Run(cmd, 1, True)
got it, if anyone is interested .sorry again
Heya,
I have the following codeing in a .vbs file.
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\Test.exe" & Chr(34), 0
Set WshShell = Nothing
Running this code excutes the test.exe hiding the promopt but without 3 paramters the exe fails. Normally this could be passed by a .bat or shortcut such as
Shortcut "C:\Test.exe" 10 1024 1024
Bat Start C:\Test.exe 10 1024 1024.
Could anyone tell me how i could put these 3 numbers into the vbs coding so my .exe will work.
You can use double quotes instead of the ASCII value to make your command a bit simpler. But the way you would execute that line is: