Many users know that in the Win10 system, you can use the search function in this computer to search for the required files, and you can let Xiaona help you search, but the search is quite long compared to using CMD search. You can use the CMD lookup method to speed up the search.
for /r Usage:
Using the find command under Linux, it is convenient to find files, then there is no similar command in Win10 to traverse the directory and find the file by file name What? The answer is:
The for /r command under Win10 has similar functionality to the find command under Linux, using a syntax similar:
find /r directory name % variable name in (match mode 1, matching mode 2) do command
matching mode can be wild like:
*.jpg: all files with .jpg suffix.
*test*: All files containing test in their name.
Note:
1. Match at least one * in the matching mode.
2. The matching content is limited to the file name and will not match the directory name.
If only the file name is found and output, the command following the do can use the @echo% variable name, ie:
for /r directory name %i in (match mode 1, match mode 2) do @echo %i
Common examples:
# List all files in the TestDir directory and all subdirectories C:\\Users\\cashey\\Desktop>for /r TestDir %i in (*) do @echo %i C:\\Users\\cashey\\Desktop\\TestDir\\b.jpg C:\\Users\\cashey\\Desktop\\TestDir\\c.png C:\\Users\\cashey\\Desktop\\TestDir\\doc\\1 .txt C:\\Users\\cashey\\Desktop\\TestDir\\doc\\2.txt C:\\Users\\cashey\\Desktop\\TestDir\\src\\test.py # Find all txt files in the TestDir directory and all subdirectories C :\\Users\\cashey\\Desktop>for /r TestDir %i in (*.txt) do @echo %i C:\\Users\\cashey\\Desktop\\TestDir\\doc\\1.txt C:\\Users\\cashey\\Desktop\\ TestDir\\doc\\2.txt # Find all txt and jpg files in the TestDir directory and all subdirectories C:\\Users\\cashey\\Desktop>for /r TestDir %i in (*.txt,*.jpg) do @echo %i C:\\Users\\cashey\\D Esktop\\TestDir\\b.jpg C:\\Users\\cashey\\Desktop\\TestDir\\doc\\1.txt C:\\Users\\cashey\\Desktop\\TestDir\\doc\\2.txt # Find out in the TestDir directory and all subdirectories All files containing test files C:\\Users\\cashey\\Desktop>for /r TestDir %i in (*test*) do @echo %i C:\\Users\\cashey\\Desktop\\TestDir\\src\\test.py
Points to note:
If there is no * in the matching mode, it will not exactly match the file name, but will output the result of the matching mode in all subdirectories, like this: Br> # The directory does not actually contain any files named abc C:\\Users\\cashey\\Desktop>for /r TestDir %i in (abc) do @echo %i C:\\Users\\cashey\\Desktop\\TestDir\\ Abc C:\\Users\\cashey\\Desktop\\TestDir\\doc\\abc C:\\Users\\cashey\\Desktop\\TestDir\\src\\abc
The above output is generally not what you expected, at least 1 in the pattern. *#
If you are used to this type of search, you will feel that this is faster than expected and can speed up your work. Work more efficiently and save more time.
1. First click the start icon in the lower left corner of the desktop with the right mouse button. 2
For the left-hander, if you adjust the function of the left and right mouse buttons, it must be very
1. Press Win+R to open the run, enter “regedit”, click OK; 2. In the open registry edito
1. In the win10 system desktop blank, right click and select Personalization (R); as shown below 2.
How to make the Win10 command prompt window semi-transparent
Windows 10 mail application already supports TLS protocol Default disable
After the win10 installation, the network card driver is missing. Solution
Can pirated windows be upgraded to win10?
Win10 how to clear the home page recently used files to make the interface more concise
Open a new start screen in Continuum mode under Win10 system
9 annoying issues with Windows 10
Win10 encountered a blue screen error CRITICAL_STRUCTURE_CORRUPTION how to do?
Win10 volume adjustment icon small speaker is missing, how to do
Win10 system Edge browser installation extensions graphic steps
Win10 system to open Windows defender protection system security method
Why does Svchost.exe of Win10 system account for the network speed?
Windows7 audio service is not running solution
Where is the win10 control panel? Will the Win10 Control Panel be cancelled?
How to change the autoplay settings in Windows 7
Why reinstall Windows system? What is the method? (1)
Win10 built-in OneNote note software copy map text
How does win7 system change user account picture?