Computing.Net > Forums > Disk Operating System > DOS Batch File - Data in File

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.

DOS Batch File - Data in File

Reply to Message Icon

Name: racattac
Date: August 1, 2004 at 18:00:10 Pacific
OS: XP
CPU/Ram: Pentium - 256 MB
Comment:

I have a batch file that executes three macro files. After the second macro is run i want to either stop the batch file or proceed to run the third macro depending on whether there is data in a particular output file. If there is no data in the file i want the macro to stop. I'm kinda new to the DOS thing and tried to look up some DOS commands only getting as far as using the FIND command to count a string in the file that is common to each record, but unfortunately reached a dead end. Can anyone help with this?

Thanks in advance.
Tony



Sponsored Link
Ads by Google

Response Number 1
Name: jboy
Date: August 1, 2004 at 18:55:07 Pacific
Reply:

Windows® XP Command Reference

XP "DOS" is an emulation, not really DOS at all, although naturally enough there are similarities.

You may have better luck posting in the XP or programming forums - this is the 'old' DOS forum.

Also maybe check this batchfile FAQ - some of the examples there are for NT based command prompts and might work in XP


I'm just looking for clues at the scene of the crime


0

Response Number 2
Name: IVO
Date: August 2, 2004 at 02:30:49 Pacific
Reply:

I do not want to offend the pure DOS guys, but I think to give help gets priority over personal opinions, especially when the help is just one line command.

So, if the file to be checked has size 0 when empty, under Win XP you can perform

For /F %%A in ("File_Name") Do If %%~zA equ 0 GoTo :EOF
...otherwise continue processing...

where File_Name is the [path]Name of the file to be checked and the statement holds one line at all.

jboy is rigth however, better to post similar XP related questions out of this forum


0

Response Number 3
Name: jboy
Date: August 2, 2004 at 07:26:12 Pacific
Reply:

No offense taken - if someone can help, that's fine.

I'm sure if I posted a Linux question here, someone might know the answer - but chances are I'd get a better response in that forum.

As far as it being a 'personal opinion' - that is not the case.

from the 'terms & rules' page, with regard to selecting a forum to post in:

" ...choose whichever one best suits your problem and post on that."


I'm just looking for clues at the scene of the crime


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: DOS Batch File - Data in File

archive in dos batch file www.computing.net/answers/dos/archive-in-dos-batch-file/12924.html

Dos Batch File Commands www.computing.net/answers/dos/dos-batch-file-commands/11921.html

DOS Batch file to FTP files from UNIX www.computing.net/answers/dos/dos-batch-file-to-ftp-files-from-unix/2105.html