(This is my first post...If you guys can help me out I promise to contribute to this forum!)
I've recently dived into the world of batch file programming, and though head-bangingly tedious trial-and-error have been slowly mastering the use of batch commands.
Yes I am a newb. As nub as they come. In my infantile audacity I have resolved to knock on the programming Gods door in the hopes that he will listen...
---
The operation I am trying to create is simple;
-
A list of documents (a text file, containing the names of other text files) has been created and should be operated upon in the order they appear. (for)
The operation must read a document and determine if it contains a certain phrase or string (findstr)
If the above operation is executed without error, then a variable will be set to [Y] If there is an error, the variable will be set to [N] (set var)
The above variable should then be recorded into a separate document; this document will eventually contain all the results of the batch operation.
The operation, continuing the original [for] command will repeat until all documents have been operated upon.
---
So far I have individual pieces of this thing working. To find text and set the variable accordingly I have:
findstr /m "[certain text]"
if %errorlevel%==0 (
set var=Y
)
if %errorlevel%==1 (
set var=N
)
To record the results of [findstr]:
echo %var%>>[a file containing the results].txt
However, I cannot seem to implement the [for] command to continue the operation past the first document in the list. As trying as I might, I am rewarded with a blank cmd screen or an error message.
---
This is my complication. Please help. If you need any more information, I will be promptly and readily willing to give it!
Thank you in advance!
I've recently dived into the world of batch file programming, and though head-bangingly tedious trial-and-error have been slowly mastering the use of batch commands.
Yes I am a newb. As nub as they come. In my infantile audacity I have resolved to knock on the programming Gods door in the hopes that he will listen...
---
The operation I am trying to create is simple;
-
A list of documents (a text file, containing the names of other text files) has been created and should be operated upon in the order they appear. (for)
The operation must read a document and determine if it contains a certain phrase or string (findstr)
If the above operation is executed without error, then a variable will be set to [Y] If there is an error, the variable will be set to [N] (set var)
The above variable should then be recorded into a separate document; this document will eventually contain all the results of the batch operation.
The operation, continuing the original [for] command will repeat until all documents have been operated upon.
---
So far I have individual pieces of this thing working. To find text and set the variable accordingly I have:
findstr /m "[certain text]"
if %errorlevel%==0 (
set var=Y
)
if %errorlevel%==1 (
set var=N
)
To record the results of [findstr]:
echo %var%>>[a file containing the results].txt
However, I cannot seem to implement the [for] command to continue the operation past the first document in the list. As trying as I might, I am rewarded with a blank cmd screen or an error message.
---
This is my complication. Please help. If you need any more information, I will be promptly and readily willing to give it!
Thank you in advance!