0

We use an aspx webpage that has two variables in the link. Example:

aspxpage.aspx?argument1=arg1&argument2=arg2

the aspx calls a .cmd and needs to pass the two arguments to it divided by a space. When I started working on this, no arguments were passed. The code was:

dim wshell
dim arg1
dim arg2
dim runcmd

arg1 = Request.Querystring("arg1")
arg2 = Request.Querystring("arg2")

wshell = CreateObject("WScript.Shell") 
runcmd = """path\to\run.cmd """ + arg1 + " " + arg2
wshell.run (runcmd, 1, true )
wshell = nothing

The result was nothing as no argument was passed to the .cmd and no errors occured.

Changed the runcmd line to:

runcmd = """path\to\run.cmd"" " & arg1 & " """ & arg2 & """"

The result shows that only arg1 is being passed. No error message occurs.

How to establish that also arg2 is being passed.

Have found similar questions but using that code has no result and gives errors that the closing “ are missing etc.

Passing parameters from vbscript to batch file first answer second line of code is same setup as my code, but is not working.

1 Answer 1

0

CMD was running more often than the result showed in the webpage. It ran by using following code:

runcmd = """path\to\run.cmd"" " & arg1 & " " & arg2 & ""
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.