Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

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

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

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

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

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