Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am totally new to writing batch files. I will like a batch file that does the following:
The file which will be called runProc will be called with three parameters
Param 1 – will be a date, its format will be ddmmyy
Param 2 – will be a sleep period, its format will be nn (e.g. 20) – I will be using the _sleep.exe. This file will reside in my C:\me folder
Param 3 – will be a retry count, its format will be r (e.g. 3)When this batch file is called (with the parameters), it will run a VBScript (cscript.exe c:\abc.vbs) which on completion will return one of the following error codes. Errorlevel 0, 1, or 2. If the VBScript returns errorlevel 2, I want to be able to run the VBScript again. The number of times that I run the VBscript will depend on the configuration of Param 3. If it is set to zero. Then the batch file should exit. Also if the errorlevel returned by the VBscript is either 0 or 1, I will want the batch file to exit.(No retires)
Please can anyone help me with a batch file?
Thanks a lot

I think you want something like this:
@echo off
set retry=%3
if not defined retry set retry=0
:retry
cscript.exe c:\abc.vbs
if not errorlevel=2 goto eof
if %retry% LEQ 0 goto eof
set /A retry -= 1
goto retry
:eofI haven't involved the "sleep period" since you didn't mention where it should go. It would also be good to include some help information (in case the parameters passed aren't appropriate).
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |