How can I execute two consecutive commands on the command line with the help of wshshell.exec
or wshshell.run
in vbscript? For example I need to execute cd C:\a
and then winzip32.exe -min -a D:\a
.
views:
153answers:
2
+1
A:
You can do something like cd C:\a & winzip32.exe -min -a D:\a
where the &
separates commands so the that second one runs once the first has finished successfully. For example, you could run it like this:
Set oExec = WshShell.Exec("cmd /c cd C:\a & winzip32.exe -min -a D:\a")
Without the cmd /c
in the beginning, you can't do things like cd
because it is cmd.exe that processes the cd
and &
.
Gabe
2010-03-18 06:08:48
sushant
2010-03-18 06:18:26
sorry i dont know how to format it
sushant
2010-03-18 06:19:33
Where are you using that HTML? In a HTA or a normal web page? Just wondering cause normally WshShell cannot be created in a web page as it is considered unsafe.
tyranid
2010-03-18 06:23:23
you r a life saver. thanks a looooooooooot :)
sushant
2010-03-18 06:27:03
A:
Depending on what you're doing, you could use WshShell.Exec "c:\a\winzip32.exe -min -a D:\a"
leereid
2010-03-22 01:37:17