1.

Solve : need help in writing batch file?

Answer»

I need help writing batch file because I havn't done before.

My Requirement is

1. Check if the file (file.txt) exists...

2. If the file exists 'exit' out...

3. Check for the error file(error file.txt)

4. If it exists wait for 15 minutes

5. Rerun the job(balance script.bat)

Anybody can help this. Thanks in advanceIt is pointless including the word 'urgent' in your subject line. It will not get you an answer any quicker.

Code: [Select]@echo off
:rerun
if EXIST file.txt exit
if EXIST "error file.txt" ping localhost -w 900000
goto rerun
Hope this helps
,NICK(macdad-)vbscript alternative
Code: [Select]Set objFS = CreateObject("Scripting.FileSystemObject")
strFile = "c:\test\file.txt"
strFileError = "c:\test\error.txt"
If Not objFS.FileExists(strFile) Then
If objFS.FileExists(strFileError) Then
WScript.Sleep 54000
End If
End If
save as script.vbs and on command line(or batch file)
Code: [Select]cscript /nologo script.vbs
I was trying like this but it's not working


@ECHO OFF

IF EXIST "Report_File.txt" GOTO END

IF EXIST "Error_File.txt" GOTO ERROR

:ERROR

PING 1.1.1.1 -n 1 -w 900000 2>NUL | FIND "TTL=" >NUL

CALL balance_script.bat

:END

EXITQuote from: TDP on April 24, 2009, 12:24:08 PM

it's not working

Meaning?
as usual, expect us to be psychicsI tried the following it's working

@echo off
:rerun
if EXIST "C:\work\123.txt" goto END
if EXIST "C:\work\error.txt" ping localhost -w 6000
goto rerun
:END

Thanks a Lot folksSorry, I assumed you had the batch file in the same directory as the files.Quote from: macdad- on April 24, 2009, 04:55:10 PM
Sorry, I assumed you had the batch file in the same directory as the files.

You know what happens when you assume...

YEA...


Discussion

No Comment Found