Advertisement
MangaD

Search shortcut in sub-folders

Apr 18th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.51 KB | None | 0 0
  1. @echo off
  2.  
  3. set rootDir=%CD%
  4. echo Starting at "%rootDir%".
  5.  
  6. set /p ans="Launch: "
  7. echo Searching for %ans%
  8.  
  9. goto treeProcess
  10.  
  11. :end
  12. cd %rootDir%
  13. exit
  14.  
  15. :treeProcess
  16. ::search in current directory
  17. echo Searching in "%CD%".
  18. if exist "%ans%.lnk" (
  19.     echo Found "%ans%.lnk"
  20.     start "" "%ans%.lnk"
  21.     goto end
  22. ) else if exist "%ans%.url" (
  23.     echo Found "%ans%.url"
  24.     start "" "%ans%.url"
  25.     goto end
  26. )
  27. ::go to subfolders
  28. for /d %%d in (*) do (
  29.     cd %%d
  30.     call :treeProcess
  31. )
  32.  
  33. echo "file not found!"
  34. cd %rootDir%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement