Run .BAT from vb script

davidpayten

Board Regular
Joined
May 24, 2004
Messages
225
Hi All,

I want to run a .BAT file that will unzip a file for me. Atm i cannot find a way of executing winzip from vb script effectively and thought this would be a nice workaround since I have a bat file that does this for me.

So, q is "How do you create .BAT as an object / how would I get this to work?

Any ideas would be much appreciated.

Thanks!

Dave
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi All,

I want to run a .BAT file that will unzip a file for me. Atm i cannot find a way of executing winzip from vb script effectively and thought this would be a nice workaround since I have a bat file that does this for me.

So, q is "How do you create .BAT as an object / how would I get this to work?

Any ideas would be much appreciated.

Thanks!

Dave

one way to do this

Shell "C:\WINDOWS\system32\cmd.exe" & " C:\YourDirectory\YouBatFileName.BAT"
 
Upvote 0
Just for ref in case someone else is looking into this at a later date...

if you did want to unzip via .BAT you could use another utility (freeware) such as 7-zip

Below would zip files

Code:
"C:\Program Files\7-zip\7z.exe" a -tzip "full path of to be created zip file" "full path of file to be zipped"

unzip

Code:
"C:\Program Files\7-zip\7z.exe" x "full path of file to be unzipped" -o "full path of folder into which unzipped files & folders to be extracted" -y
 
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,790
Members
448,994
Latest member
rohitsomani

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top