Executing a DOS Batch file with Shell with VBS script


'Executing a DOS Batch file with Shell with VBS script.

'Code by Kiran
'You can run Batch file with simple text file called VBS file without VB executable
'Paste following code on notepad and save it with .VBS extension; once you double click this it automatically executes the DO Batch file

Set oShell = CreateObject("WSCript.shell"wink

sCmd = "C:\\yourbatchfile.bat"

' If you have spaces in the path, you can do like following instead:
'sCmd = Chr(34) & "j:\\yourbatchfile.bat" & Chr(34) 'commented

' The 0 will make it run hidden
oShell.Run sCmd, 0, False

' The 7 will make it run minimized
'oShell.Run sCmd, 7, False 'commented


You can view this article online at:
http://www.kiranreddys.com/knowledgebase/index.php/article/executing-a-dos-batch-file-with-shell-with-vbs-scr