Computing.Net > Forums > Programming > Batch Files

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Batch Files

Reply to Message Icon

Original Message
Name: rickz
Date: August 7, 2006 at 07:38:53 Pacific
Subject: Batch Files
OS: win xp
CPU/Ram: p4
Model/Manufacturer: pb
Comment:

Hi there.

I WANT TO DELAY A BATCH FILE UNTIL IT HAS FOUND A PARTICULAR FILE FROM A DIRECTORY AND KEEP PROCESSING AFTER IT FINDS IT.

THANK YOU


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: August 7, 2006 at 09:00:46 Pacific
Reply: (edit)

In general, a batch executes one line at a time. So it will "delay" while it's finding the file.


If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal

Response Number 2
Name: rickz
Date: August 7, 2006 at 11:54:29 Pacific
Reply: (edit)

sorry, i forgot to mention:

Suppose i am compiling a java file and a batch file is associated with the java file and they both execute simultaneously. so, the funtion of my batch file is to delete all .cls files created by the java compiler. By this time my batch programme waits until it finds .cls file. but if i press any key on mybatch_file before the java compiler completes comiling, the batch programme will exit, since it didn't find any .cls file.


Report Offensive Follow Up For Removal

Response Number 3
Name: Shr0Om
Date: August 8, 2006 at 03:35:49 Pacific
Reply: (edit)

This could be a way..
If no cls files are found, the script will wait for about 3 sec's and check again. If found, del and exit.

Although, this means that if there's only one cls file, it will exit after deleting it, thus not removing perhaps other cls files..


@echo off
:start
if exist *.cls (del *.cls & exit) else ping localhost -n 3 >nul & goto start


Report Offensive Follow Up For Removal







Post Locked

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


Go to Programming Forum Home








Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 7 Days.
Discuss in The Lounge
Poll History




Data Recovery Software