|
Answer» would it be easier to use a batch file to search through my computer for a list of programs? or is there a better language i can learn and useCan you be more specific on what you want to do?
Do you want to search for a particular file? Or do you want to list programs in the Start Menu? And if Start Menu, do you want to list files for a particular user, or just files that available to all users? Or do want to list programs in the "Program Files" directory? Or do you want to list programs that show up under the "Add / Remove Programs"?i want to hunt down hidden files/ programs that i only know the name of.
if that made sincesay i have a list of programs and i want to make the file hunt them down. print them on the screen and ask if i want to delete them.
so i should go to vbscript?? :-?Well, if you wanted to list and prompt to delete all files on your C: drive that contained the word "notepad", then you could do it in one line of a batch file: Code: [SELECT]del /s /p /f c:\*notepad* Is that what you are looking for?kind of but i want it to open a .txt with a list of WORDS to look for and if found display the path..yes it can be done , in batch/vbscript/perl/python/java/c/ etc and other languages. it all depends on how comfortable/experienced you are in a certain language. For me personally, i use Python to do my every task, sometimes i need to search for files with certain patterns too... eg Code: [Select]>>> import os >>> os.chdir(somedir) >>> for root,dir,files in os.walk(somedir): ... for fi in files: ... all = open(fi).readlines() ... if "pattern" in all: ... print "Found pattern in %s" %(os.path.join(dir,files))
if you are more inclined to program in batch , its something LIKE this:
findstr if %errorlevel% == 0 remove file (Please checkhttp://www.ss64.com/nt/index.html for batch commands.)
Likewise, the same can be done for other languages...So you want to list all files on your C:, and save the list to a text file? If so, try this: Code: [Select]dir C:\ /b /s /a >C:\dirlist.txt Then you can use notepad (or any word processor, etc.) to open the C:\dirlist.txt file.ok know how would i do the opposite?? have a file name from a list be hunted down? and put into a different txt with its path
srry if im being difficult So you want to list all files that DO NOT contain the specified text?I might as well throw in my 2¢ since everyone else has.
Code: [Select]@echo off for /f "TOKENS=* delims=" %%i in (list.txt) do ( dir /s /a-d /b c:\*%%i* >> c:\match.txt )
If the file with a file name from a list be hunted down has complete file names, you can remove the wildcards from the DIR command.
As I said, just my 2¢ 8-)
|