Batch Help: [for In Do] Agh!

chaos945

OSNN Senior Addict
Joined
10 Feb 2003
Messages
934
I'm trying to get this script to find the location of SPYBOTSD.exe on all available drives and then run it. Any suggestions would be helpfull!

Successfully I've gotten the script to search specified drives for the string spybot then output the findings, but I can't actually use the output as a variable. Also I've been experimenting with the FOR command but no luck as of yet.

/EDIT
I could actually get the script to find spybotsd.exe exactly and output the line number, but how would I tell the program to run it at that line?

Code:
@ECHO OFF
IF EXIST *OUT.TXT DEL *OUT.TXT
TREE /F c:>[C]OUT.TXT
TREE /F g:>[G]OUT.TXT
FIND /I /N "SPYBOT" [C]OUT.TXT
FIND /I /N "SPYBOT" [G]OUT.TXT
IF EXIST *OUT.TXT DEL *OUT.TXT
ECHO.
ECHO.
ECHO %ERRORLEVEL% ERRORS DURING PROCESS
PAUSE
 
I was so close then M$ snatched it away, using a 3rd party command "LOCATE" I was able to get the script to successfully find SPYBOTSD.exe then create a file based on the location found, and based on the command I associated with it "PATH" in this case.

In theory, it was supposed to update the PATH's list to include the new location found but unfortunately, it didn't! Why? I don't know...probably because the PATH was specified inside the CALL procedure of another running script or something like that. Another idea I had was to try to APPEND the procedure "START SPYBOTSD.exe" to the end of the generated file...but no such luck using the default available files.

/EDIT
BTW, I did manage to get the script to actually find SPYBOTSD.exe then run it every single time successfully, the problem is I can't use switches doing it this way making it completly useless for my purposes!!! To do it this way add "START" instead of "PATH".

CODE TO RUN FIND SPYBOTSD.EXE THEN RUN IT AUTOMATICALLY:
Code:
@ECHO OFF
DEL %TMP%\*.* /q
DEL %TEMP%\*.* /q
CLS
IF EXIST *START.BAT DEL *START.BAT
PATH FILES;%SYSTEMROOT%\System32\Wbem\
LOCATE SPYBOTSD.EXE /F:1 /B:"start">SPYBOT_START.BAT
CALL SPYBOT_START.BAT
IF EXIST *START.BAT DEL *START.BAT
ECHO.
ECHO %ERRORLEVEL% ERRORS DURING PROCESS
PAUSE
ATTEMPTED CODE TO FIND SPYBOTSD.EXE THEN RUN IT AUTOMATICALLY WITH SWITCHES
Code:
@ECHO OFF
DEL %TMP%\*.* /q
DEL %TEMP%\*.* /q
CLS
IF EXIST *START.BAT DEL *START.BAT
PATH FILES;%SYSTEMROOT%\System32\Wbem\
LOCATE SPYBOTSD.EXE /F:1 /B:"PATH">SPYBOT_START.BAT
CALL SPYBOT_START.BAT
SPYBOTSD.EXE /autoupdate /autoimmunize /autocheck /autofix /autoclose
IF EXIST *START.BAT DEL *START.BAT
ECHO.
ECHO %ERRORLEVEL% ERRORS DURING PROCESS
PAUSE
 
Can you use this one? It retrieves the application path from the registry.
(That's just one line.)

for /f "usebackq skip=4 tokens=6,7*" %%a in (`reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Spybot - Search & Destroy_is1" /v "Inno Setup: App Path"`) do "%%a %%b %%c\spybotsd.exe" /autocheck

Does spybot close automatically if you additionally use the /autofix switch? Otherwise you would have to use the start command for the batch to continue. (start "spybot" /b ...)

Edit: Just saw there is an /autoclose switch ..
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back