Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::This batch script searches a directory using your query.
- @echo off
- :start
- set "TEST=%~1"
- if not "%TEST%"=="" (
- set "DIRECTORY=%~1"
- goto test
- ) else (
- echo Enter the folder you would like to search in below.
- echo (Note: Subfolders will be searched as well.^)
- echo.
- set /p DIRECTORY= "Directory: "
- )
- :: ======================================================
- if "%DIRECTORY%"=="" (goto none) else (goto test)
- :none
- cls
- echo No folder selected.
- echo.
- echo Restarting search...
- timeout /t 3 /nobreak > nul
- cls
- goto start
- :test
- if exist "%DIRECTORY%" (cls & goto search)
- cls
- echo That folder does not exist.
- echo.
- echo Restarting search...
- timeout /t 3 /nobreak > nul
- set "DIRECTORY="
- cls
- goto start
- :: ======================================================
- :search
- echo A search will now be performed within the following folder:
- echo "%DIRECTORY%"
- echo.
- echo ------------------------------------------------------------------
- echo.
- echo Search for what file name?
- echo.
- set /p "SEARCH=Search: "
- cls
- dir "%DIRECTORY%\*%SEARCH%*" /s /b
- :: ======================================================
- echo.
- echo Search completed.
- timeout /t 2 /nobreak > nul
- echo.
- pause
- cls
- set "DIRECTORY="
- goto start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement