Home > Software engineering >  Batch in the disk C automatically search the specified file, find to A program, can not find to C pr
Batch in the disk C automatically search the specified file, find to A program, can not find to C pr

Time:10-06

I want to write A batch, automatic search throughout the entire disk C specified file (such as dd. TXT, this file is not under the root directory, directory possible hidden deep,), find the words to A program, can't find the words to A C program, no matter how much we find during A dd. TXT, as long as find A even find on disk C, you can jump straight to A program, if the search is less than the whole disk C, jump into A C program. This code can be found under the file to A program, but can't find the words to automatically quit, can't jump to C program, please help, thank you.
Set "FileName=dd. TXT"
Set "drivename=c"
For a % % in drivename (% %) do (if exist % % a: \ nul (for/f "delims=" % % b (' in dir/a - d/s/b "% % % % a: \ * FileName" 2 ^ & gt; Nul ') do (if/I "% % ~ NXB equ" FileName "% %" (goto A))))

A
XXXXXXXXXXX

CodePudding user response:

(if/I "% % ~ NXB equ" FileName "% %" (goto A))))

If not equal? You don't do any operation

CodePudding user response:

 set "FileName=dd. TXT" 
Set "drivename=c"
For a % % in drivename (% %) do (if exist % % a: \ nul (for/f "delims=" % % b (' in dir/a - d/s/b "% % % % a: \ * FileName" 2 ^ & gt; Nul ') do (if/I "% % ~ NXB equ" FileName "% %" (goto A))))

C.e xe. Can't find the call C
Goto the End; After perform the C end

A
XXXXXXXXXXX

; The End; Ending tag

CodePudding user response:

Correction: before the End should be a colon :
  • Related