The batch command
Search for files: QQ. Exe
Search is: C, D, E,
Reality: real-time display search path as a result, the detailed display, search out the statistics search out how many total QQ. Exe file (real),
My code:
@ echo off
Color 0 a
The title is trying to search...
Echo.
Setlocal ENABLEDELAYEDEXPANSION
Echo off key word: QQ
Echo.
Echo search scope: (C, D, E)
Echo.
Echo search path:
For/r c: \ % % I in (QQ. Exe) do (
If I echo exist % % % % I
The set/a num +=1
)
Echo.
Echo searching...
Echo.
The title search is completed...
Echo.
Echo to search: total num % % files,
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Pause
Can display the search to the real path of detailed, but the calculated result is not real, figured in the temporary file to,
At the back of the batch is bad to do judgment,
One again, I want to search multiple disk at the same time, at the same time gradually show the path of the search for real (C, D, E, one by one search shows), do the final statistical results,
Please master the way!
CodePudding user response:
Three plate stacking statistics have been solved, no master to help solve search real file, statistics the number of the real file???????CodePudding user response:
System (" dir/b/a - d c: \ \ *. * & gt; D: \ \ allfiles TXT ");//read file d: \ \ allfiles TXT content of C: \ \ under the names of all files
System (" dir/b/a - d/s c: \ \ *. * & gt; D: \ \ allfilesinsub TXT ");
//read file d: \ \ allfilesinsub TXT content that is C: \ \ under the names of all files contain subdirectories
System (" dir/b/active directory c: \ \ *. * & gt; D: \ \ alldirs TXT ");
//read file d: \ \ alldirs TXT content of C: \ \ under the names of all the subdirectories
Please remember, can use the shell command to get the file and folder information or manipulate files, folders had better use the shell command to get or operation, and don't use all sorts of API access to or operation, because when it comes to illegal folder name or illegal filename or illegal file length, illegal file date, compressed file, link files, sparse file... All sorts of unexpected situations, such as API can deal with incomplete or into an infinite loop, and shell commands not,
CodePudding user response:
Hello, first of all, thank you, but that I'm asking for is a batch command, I can do that in front of the existing problems are: read out is real file, and statistical computing to non-existent files are included, I think the real statistics the number of files,