Batch Help: [for In Do] Agh!

chaos945

OSNN Senior Addict
#1
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
 

chaos945

OSNN Senior Addict
#2
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
 

yoyo

_________________
#3
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 posts

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,971
Messages
673,300
Members
89,016
Latest member
Poseeut