I need a batch script in which
I have to check in a file for "RUNNING" string, if it is not there then i have t
o generate a file Named with "Start_JOB" and if i found the "RUNNING" string in
to file then i have to do a additional check for a file into a folder and then i
have to delete that file.
HANDLING STRING THROUGH IF AND ELSE IN DOS
Moderator: DosItHelp
Re: HANDLING STRING THROUGH IF AND ELSE IN DOS
For the example I imagined some file names.
This file is named "searchHere.txt" in my example.
You didn't tell us a file extension, thats why I don't use an extension
I called this file "deleteMe.txt" and I hope the string is really all caps.
Regards
aGerman
aatman.kumar wrote:
I have to check in a file for "RUNNING" string
This file is named "searchHere.txt" in my example.
aatman.kumar wrote:
if it is not there then i have to generate a file Named with "Start_JOB"
You didn't tell us a file extension, thats why I don't use an extension
aatman.kumar wrote:
and if i found the "RUNNING" string into file then i have to do a additional check for a file into a folder and then i have to delete that file.
I called this file "deleteMe.txt" and I hope the string is really all caps.
Code: Select all
@echo off &setlocal
findstr /c:"RUNNING" "searchHere.txt" >nul &&(
if exist "deleteMe.txt" del "deleteMe.txt"
) || (
>"Start_JOB" echo Your File Content
)
Regards
aGerman