tags:

views:

254

answers:

2

I want to create a batch file which only continues if MASTERRESET.DLL consists of the following lines:

ih7rhj49g9r0390jf89j39hfj439jf948hf89h3j89fj98rh893f893b9bf983b89bf89rhf89hr89fh389h9hr893rr 0jf3rj09ihf3hr9f8987743h9voirjf893hfh3hf03j03fjfe00fej33893uo34h83484fb3iuu3f94hf4hr8h498r94

I just want the batch file to check the .dll file like it would on a .txt file. It just reads it, when it matches, it should use GOTO.

(yes, WINDOWS)

How can I do this?

AND NO, It isn't any secret password or something like that. The code might be different (well, i'm sure.) but it's just to let you know how long it is and that it are 2 lines.

+2  A: 

I don't understand what you hope to accomplish, but...

Find "ih7rhj49g9r0390jf89j39hfj439jf948hf89h3j89fj98rh893f893b9bf983b89bf89rhf89hr89fh389h9hr893rr" MASTERRESET.DLL
If Errorlevel 1 Goto NotFound
Find "0jf3rj09ihf3hr9f8987743h9voirjf893hfh3hf03j03fjfe00fej33893uo34h83484fb3iuu3f94hf4hr8h498r94" MASTERRESET.DLL
If Errorlevel 1 Goto NotFound

Rem whatever you need to do when a match is found, put here

:NotFound

Rem done

Naturally, if you want this to run silently, you'd turn echoing off and redirect output to NUL, like so:

@Echo off
Find "ih7rhj49g9r0390jf89j39hfj439jf948hf89h3j89fj98rh893f893b9bf983b89bf89rhf89hr89fh389h9hr893rr" MASTERRESET.DLL > NUL
If Errorlevel 1 Goto NotFound
Find "0jf3rj09ihf3hr9f8987743h9voirjf893hfh3hf03j03fjfe00fej33893uo34h83484fb3iuu3f94hf4hr8h498r94" MASTERRESET.DLL > NUL
If Errorlevel 1 Goto NotFound

...
Shog9
when i run that, you see : MASTERRESET.DLL-that long code-how can i run that silent??
YourComputerHelpZ
something like 'Find /Q .......
YourComputerHelpZ
Eh? Just redirect the output. I've updated the answer... You should really consider reading the Windows help file if you plan on doing anything non-trivial with batch files though. Or maybe just learn a real programming language...
Shog9
it does work but it creates a NULL file in the dir the batch file is created.
YourComputerHelpZ
NUL. Not "NULL", NUL. Not to be rude, but please read the help file - this is all stuff you should know already if you plan on messing around with batch files.
Shog9
hehh. :) i was forgotten it was 'nul' and not 'null'. maybe it was a spelling mistake ...?
YourComputerHelpZ
A: 

If the target file is actually a dll then findstr.exe might be a better choice over find.exe

Better still would be to establish the md5 sum of the dll in question, then check to see if it is the same. My current favorite: http://md5deep.sourceforge.net/ but you have lots of choices if you dig a bit.

md5deep.exe can check to see if this dll exists, or has changed, and will alert your script via errorlevels - check the docs for examples. Pretty straightforward.

Rob

RobW