0

Could anyone give me example code to access the command line through VBScript? I want to execute two commands respectively in a command prompt.

For example, first command: cd C:\a, second command: winzip32.exe -min -a D:\d.

0

2 Answers 2

2

you can use wshell.Run. The other one is wshell.exec

Sign up to request clarification or add additional context in comments.

2 Comments

but can it be used to run certain set of commands rather than just launching an application?
if you use it in a loop, yes.
1

Put your commands in a .cmd or .bat file and then run that. You could even build the batch file inside your script if it is not static.

MyBatch.cmd

CD C:\a
winzip32.exe -min -a D:\d

MyScript.vbs

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "MyBatch.cmd"

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.