0

I am using the following code to call a batch file:

dim shell  
set shell=createobject("wscript.shell")  
shell.run "a.bat D:\a"  
set shell=nothing    

How do I call more than 1 batch file, so that when the 1st file's execution is over the 2nd file is executed. as always, I really appreciate any help offered.

3
  • what is it in your batch that you can't do directly in vbscript? Commented Mar 30, 2010 at 5:41
  • Possibly it's a third party, or legacy, tool that isn't worth rewriting. Commented Mar 30, 2010 at 5:53
  • in my batch files i am calling command line to copy files and zip them Commented Mar 30, 2010 at 6:05

2 Answers 2

3

Below

shell.run "a.bat D:\a"

add another line with another

shell.run "b.bat ...."

Or create a batch file that calls all the other batch files, and call that batch file from your script.

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

4 Comments

my a .bat looks like: D: cd D:\d winzip32.exe -min -a D:\a my c.bat looks like: xcopy D:\d D:\o /E my b.bat looks like: call a.bat call c.bat when i execute b.bat,it calls a. bat but not c.bat
do the batch files work independently? ie manually run a.bat and then c.bat.
when i execute c.bat(xcopy D:\d D:\o /E) it prompts to enter d( for directory) or f (for files). may b that is causing the problem. how do i eliminate this prompting and set d(directory) as default
fixed the prompting problem used a "\" after destination path. but still it does not work if called simultaneously.but if i call the xcopy file first and then zippping file then it works.
1

Option explicit

Dim oShell

set oShell = Wscript.CreateObject("WScript.Shell")

oShell.Run "RunAs /noprofile /user:Admininistrator ""%comspec% /c 1stcommand && 2ndcommand && 3rdcommand""", 1, false

WScript.Sleep 1000

oShell.Sendkeys "AdmininistratorPassword~"

Wscript.Quit

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.