![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
need some batch help
i'm trying to delete a cookie with specific contents using a batch file. the cookie has the word "eservices" in it. every once and a while it goes nuts and i lose some functionality in my work browser, and i'm trying to get a quick one-click solution for that. here's what i've got.
Code:
@ECHO OFF CD C:\Documents and Settings\%USERNAME%\Local Settings\Temporary Internet Files del /Q *eservices*.txt pause "Could Not Find C:\Documents and Settings\bburr\Local Settings\Temporary Internet Files\*eservices*.txt" there's the problem - the cookie's name is some jumble of letters and numbers. i'm trying to delete a cookie that has the word IN it, not in the name. ideas, anyone? i can get you a copy of the cookie if you want.
__________________
|| how to computer: a faq on hardware || computer building || prophetikmusic.net || i write music. i fix and build computers. talk to me for information regarding either subject. |
| Sponsored Links |
|
Please register to remove the above advertisement. |
|
#2
|
||||
|
||||
|
You'd need a for loop and searching for the string inside the file, something like:
file1.bat: Code:
@echo off
cd C:\Documents and Settings\%USERNAME%\Local Settings\Temporary Internet Files
for /f %%a IN ('dir /b *.txt') do call file2.bat %%a
pause
Code:
@echo off findstr /m "eservices" %1 if %errorlevel% == 0 del /Q %1 pause |
|
#3
|
||||
|
||||
|
I'd copy the cookie in question plus a few others into a new folder and run the batch script in there to make sure it actually works, before letting it loose on your proper cookie folder.
|
|
#4
|
||||
|
||||
|
Quote:
__________________
|| how to computer: a faq on hardware || computer building || prophetikmusic.net || i write music. i fix and build computers. talk to me for information regarding either subject. |
|
#5
|
||||
|
||||
|
getting closer!
Code:
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in ('dir/b *.txt') do (
find /i "eservices" < %%a > nul
if not errorlevel 1 echo del %%a
)
pause
can anyone tell me why this doesn't work? is this permissions or syntax? also, if i can get it to run on a folder rather than locally, that's even better.
__________________
|| how to computer: a faq on hardware || computer building || prophetikmusic.net || i write music. i fix and build computers. talk to me for information regarding either subject. |
|
#6
|
||||
|
||||
|
What happens if you remove the 'echo' in front of the del command? I don't know Windows batch files well enough to have coded you a solution, but I do know many of the commands, and echo is used to print stuff out to the screen.
|
|
#7
|
||||
|
||||
|
that does it =) i'll test it more tomorrow. only issue is that it appears to permanently delete it, rather than move it to the recycle bin (which would be preferable). time for more testing.
__________________
|| how to computer: a faq on hardware || computer building || prophetikmusic.net || i write music. i fix and build computers. talk to me for information regarding either subject. |
|
#8
|
||||
|
||||
|
Yeah, Windows doesn't offer a command-line method of sending stuff to the recycle bin; the command-line stuff is all inherited from DOS, which had no recycle bin. Take a look at this for a few ways to recycle from the command-line (the path to the recycle bin doesn't work on Windows 7, though there's probably some other path that would work).
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|







Linear Mode
