How to Find Files Fast Using DOS and Notepad
Do you have a large hard drive? Mine isn’t very big, but I’ve still got over 90,000 files on it.
When I use Windows built in search tool to search for files, it seems to take ages for it to even start looking. It’s almost like the search tool wakes from a deep sleep and decides to start work after a cup of coffee. I can’t blame it, I feel the same way most mornings.
The solution I’ve come up with works for me and maybe it’ll work for you as well. It doesn’t require any tools that aren’t already on your Windows machine.
I wanted to search a network drive with over 600,000 files on it. Windows searches were taking up to half an hour to produce results. I was prepared to take a lunch break when I initiated a search.
I decided to fall back on my rusty old skills as a DOS batch file guru.
I wrote up a single line of text in Notepad with the following command on it where M: was the network drive I wanted to search.
DIR /B /S M:*.* > C:M_file_list.txt
Then I saved the file as a .BAT file in a handy location.
Double clicking the BAT file launched it. When I launch a batch file, it helps if I stand and pronounce this chant in a loud voice with both hands raised over the PC.
By the Power of DOS, I command you!
That really works best in a quiet room full of people who have no clue what I’m doing.
Fifteen minutes later, I had a text list that included the full path of all 600,000 files on the M: drive.
Now whenever I need to find a file, I open up the M_file_list text file and hit F3 or CTRL+F to open up the text search dialog.
Searching the text file is hundreds of times faster than Windows standard search was taking. The search takes around 5 or 10 seconds instead of half an hour. That does cut into my long lunch breaks, but we all have to sacrifice things in these hard times.
When I find the file I want, I copy the file path and paste it into the Start -> Run menu, to open the folder or the file itself.
Happy searching!
You can leave out the chanting if you have to.
Comment Using Facebook
9 Responses to this Article | Share your Opinions/Comments
We moderate comments to prevent spam. Moderation is done within few hours. Please try and stay on topic and refrain from using abusive language. If you think there is a problem with this post, please email the post author or send us an email at tips@techie-buzz.com with the URL and the problem you see and we will rectify it as soon as we can.


Honestly, I’ve over 150,000 files stored in my hard drive and it’s a painfully task to browse through it! Maybe this little trick is going to help me eliminate the hassle away. Thanks again, Clif.
Ultimate work. Thanks for the post.
Sriram
Thanks for the comment Wilson. I hope it does help you. If it doesn’t there are a few other tricks that I’m sure I and others here can recommend.
Thanks for this tip, I always like the MSDOS tags :)
Great job Clif
Thanks Soumen, I appreciate the comment.
Hey Clif~
Stumbled upon this post and thought it was just great.
Got bored and wrote a 30 min AutoHotKey script that will parse through the file you created and allow you to search within the lines in a listview GUI. In other words if you search for “ins” you will get all the lines displayed that have “ins” in them. Then you can right click and choose to run that line or copy it to the clipboard. I know there is Everything by VoidTools which is so much better, but like I said, I got bored. :)
John-Paul
apathysoftworks.com
Here is the script:
SetBatchLines, -1
Width := 600
Height := 600
;I have made the menu expandable. Just add the new commands you want delimited by `n with no spaces then create a new label with that name :)
Menu_Items = Run_Line`nCopy_Line
Loop, Parse, Menu_Items, `n
Menu, CTX, Add, %A_LoopField%, OnMenu
Gui, Add, Edit, vUser_Query w600
Gui, Add, Button, gSearch, Search
Gui, Add, ListView, w600 h600 vLV_Content gOn_LVEvent AltSubmit, File Lines
Gui, Show, , Quick Find
FileSelectFile, Loaded_File
FileRead, File_Content, %Loaded_File%
SplashTextOn, 200, 200, Parsing File, `nPlease wait a moment`n`nIf the file is big it could take a minute or two
Gui, +Disabled
Build_List(File_Content)
Gui, -Disabled
SplashTextoff
return
GuiClose:
ExitApp
return
OnMenu:
Goto, %A_ThisMenuItem%
Return
On_LVEvent:
Line_Text =
if (A_GuiEvent = “RightClick”)
{
MouseGetPos, X, Y
LV_GetText(Line_Text, A_EventInfo)
Menu, CTX, Show, %X%, %Y%
}
return
Run_Line:
StringReplace, Line_Text, Line_Text, `n, , All
StringReplace, Line_Text, Line_Text, `r, , All
Run, %Line_Text%
return
Copy_Line:
StringReplace, Line_Text, Line_Text, `n, , All
StringReplace, Line_Text, Line_Text, `r, , All
Clipboard = %Line_Text%
TrayTip, Copied!, %Line_Text%
SetTimer, Tray_Off, -4000
Return
Tray_Off:
TrayTip
return
Search:
Critical
Gui, +Disabled
SplashTextOn, 200, 200, Parsing File, `nPlease wait a moment`n`nIf the file is big it could take a minute or two
GuiControlGet, Query, , User_Query
if (Query = “”)
search_list := File_Content
else
{
Loop,parse, File_Content,`n,%A_Space%%A_Tab%
{
Current_Line := A_LoopField
tcount =
tfound =
loop, parse, Query, %A_Space%,%A_Tab%
{
if (A_LoopField = “”)
return
tcount++
if instr( Current_Line, A_LoopField )
tfound++
}
if (tcount == tfound)
search_list .= Current_Line . “`n”
}
Current_Line =
}
Build_List(search_list)
search_list =
SplashTextoff
Gui, -Disabled
return
Build_List(list) {
global
LV_Delete()
StringReplace, list, list, `r, , All
Loop, parse, list, `n,%A_Space%%A_Tab%
{
if (A_LoopField = “”)
continue
LV_Add(“”, A_LoopField)
}
LV_ModifyCol(1, “AutoHdr”)
}
Hmmm Just realized the script lost all formatting and changed ” to some odd character. Here I just uploaded the file on the site so you can copy it properly:
http:\\apathysoftworks.com\temp\QuickFind.txt
Hi John-Paul – nice idea. Can you compile it and put it out as an EXE file for us to look at? I don’t keep AHK installed. I’ve used it, but never for long.