user2863872
user2863872

Reputation: 11

Running an external command in VBScript with user input

What I am trying to accomplish is to have a popup that asks a user for a numeric value, when that value gets entered, it is then placed in a certain position in a command-line and then run.

I am using this for is for an accounting software. If you need to delete a transaction from a database, you find a job ID in a report, then you run a command and enter the job id at the end of a certain string and it wipes out the transactions in the DB.

I am just trying to simplify the method....any help?

Upvotes: 0

Views: 4791

Answers (1)

langstrom
langstrom

Reputation: 1702

I would suggest reading this documentation on InputBoxes in vbscript.

You can set a variable to equal the input box, eg. strInput = InputBox("prompt") then pass the variable strInput to the dos command.

You might also read about running a command from vbscript here.

So your code would be, roughly,

strInput = InputBox("prompt")
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "program.exe /argument=" & strInput

Upvotes: 1

Related Questions