Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
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.
cd C:\a
winzip32.exe -min -a D:\d
you can use wshell.Run. The other one is wshell.exec
Add a comment
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"
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.