titishor Posted July 16, 2010 Share Posted July 16, 2010 Hello guys, I want to create a batch file that searches the entire hard drive and then displays the requested folder/song/movie. This i got so far...@ Echo off @echo Please enter the name of the file or folder you want to find!set /P=for %%i in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do if exist %%i\ @ECHO Found in this local hard drive %%i\ if NOT exist %%i\ @Echo Folder not found!! Probably you don't have it on your hard drive!I'm doing something wrong because when i enter the word , Atlantis for example it shows me this :Please enter the name of the file or folder you want to find!AtlantisFound in this local hard drive C:\Found in this local hard drive D:\Found in this local hard drive E:\Folder not found!! Probably you don't have it on your hard drive!Any help will be great...Regards, Sorin Link to comment Share on other sites More sharing options...
iamtheky Posted July 16, 2010 Share Posted July 16, 2010 if you have 4 drives on your computer, and this file is on C D & E but not on the 4th drive then that batch behaved normally, no? Link to comment Share on other sites More sharing options...
titishor Posted July 16, 2010 Author Share Posted July 16, 2010 (edited) if you have 4 drives on your computer, and this file is on C D & E but not on the 4th drive then that batch behaved normally, no?yes, the batch will behave normally , and it will find the file you're searching , on the drive...BUT , the batch ain't done yet...Like i stated before , i'm doing something wrong with the search criteria . It doesn't displays the results as it should do ... Edited July 16, 2010 by titishor Link to comment Share on other sites More sharing options...
Yzöwl Posted July 16, 2010 Share Posted July 16, 2010 Will this do you?@ECHO off & SETLOCAL enableextensions disabledelayedexpansionSET/P "TOFIND=Please enter the name of the file or folder you want to find! "FOR /F %%A IN ('MOUNTVOL^|FINDSTR [C-Z]:\\') DO CALL :SUB %%~dAPING -n 11 127.0.0.1 1>NUL & GOTO :EOF:SUBDIR/B/S/A %1\%TOFIND% 2>NUL || ECHO=%TOFIND% not found in drive %1!! Link to comment Share on other sites More sharing options...
gunsmokingman Posted July 16, 2010 Share Posted July 16, 2010 It might be better idea to use a VBS Script or an HTA with VBS Or Js Scripting to do what you want. Link to comment Share on other sites More sharing options...
titishor Posted July 16, 2010 Author Share Posted July 16, 2010 Will this do you?@ECHO off & SETLOCAL enableextensions disabledelayedexpansionSET/P "TOFIND=Please enter the name of the file or folder you want to find! "FOR /F %%A IN ('MOUNTVOL^|FINDSTR [C-Z]:\\') DO CALL :SUB %%~dAPING -n 11 127.0.0.1 1>NUL & GOTO :EOF:SUBDIR/B/S/A %1\%TOFIND% 2>NUL || ECHO=%TOFIND% not found in drive %1!!Yep, it works. Thanks for the help!!! Link to comment Share on other sites More sharing options...
titishor Posted July 16, 2010 Author Share Posted July 16, 2010 (edited) It might be better idea to use a VBS Script or an HTA with VBS Or Js Scripting to do what you want.i don't know how to write it in VB:) Edited July 16, 2010 by titishor Link to comment Share on other sites More sharing options...
jaclaz Posted July 16, 2010 Share Posted July 16, 2010 If the drives are NTFS formatted, using this may give some bettering in the performance :http://ndff.hotbox.ru/en/jaclaz Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now