Computing.Net > Forums > Disk Operating System > HELP!! Batch Files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

HELP!! Batch Files

Reply to Message Icon

Name: Milton Ezeh
Date: May 7, 2003 at 08:39:48 Pacific
OS: NT
CPU/Ram: 233/64
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: May 7, 2003 at 15:36:23 Pacific
Reply:

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
:eof

I 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


0

Response Number 2
Name: EzehM
Date: May 8, 2003 at 06:08:33 Pacific
Reply:

Thanks, it worked


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: HELP!! Batch Files

Help!! Batch File www.computing.net/answers/dos/help-batch-file/13525.html

Help batch file programming www.computing.net/answers/dos/help-batch-file-programming/14554.html

basic batch file help needed www.computing.net/answers/dos/basic-batch-file-help-needed/1019.html