0

I have installed program where I need to run a command line in order for it to do something. So I want to create a simple vbscript to carry out this command ion order for me to deploy the cmd to several machines using SCCM2012.

The program sits in the %ProgramFiles% directory and it is an 'exe' file with a cmd switch I am wanting to use, example

program.exe -testcmd

Hope this makes sense and can anyone assist please?

I have looked at the forums but I don't understand what all the command mean in the script.....(I am hopeless)

1
  • search SO as this has been answered multiple times. Commented Sep 19, 2014 at 16:55

1 Answer 1

1

You can use the Run method of the WshShell object. Just make sure to put quotes around the path to your EXE. In VBScript, you need to escape embedded quotes (by doubling them) or you can use the Chr(34) statement.

strCmd = Chr(34) & "%ProgramFiles%\program.exe" & Chr(34) & " -testcmd"
CreateObject("WScript.Shell").Run strCmd
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you Mr Bond!!! works a treat and you have just saved me several hours of getting further frustrated. have an amazing weekend! :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.