Enhance Windows Search

You know how annoying it is when you are working with files that are essentially just text files but then windows search skips over it because it does not recognize the file type? Turns out windows registers filters and they come from the author of the file type. I found this nifty utility that allows you to register the file type of your choice as a plain text file so windows explorer can search the contents for you…

Usage: reg.bat .ext1 [.ext2] [.ext3]…

Simply save the code below to a file and call it reg.bat:

@echo off
setlocal
if {%1}=={} goto syntax
set ext=%1
if {%ext:~0,1%} NEQ {.} goto syntax
@echo REGEDIT4>"%TEMP%\RegisterPTFwrk.REG"
@echo [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\%ext%\PersistentHandler]>>"%TEMP%\RegisterPTFwrk.REG"
@echo @="{5e941d80-bf96-11cd-b579-08002b30bfeb}">>"%TEMP%\RegisterPTFwrk.REG"
:loop
shift
if {%1}=={} goto :done
set ext=%1
if {%ext:~0,1%} NEQ {.} goto syntax
@echo [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\%ext%\PersistentHandler]>>"%TEMP%\RegisterPTFwrk.REG"
@echo @="{5e941d80-bf96-11cd-b579-08002b30bfeb}">>"%TEMP%\RegisterPTFwrk.REG"
goto loop
:syntax
@echo Syntax: RegisterPTF .ex1 [.ex2] [.ex3] ... [.exn]&goto :EOF
endlocal
goto :EOF
:done
regedit /s "%TEMP%\RegisterPTFwrk.REG"
endlocal

Many thanks to the original author of this…!

Comments are closed.