Computing.Net > Forums > Programming > Nested loops in batch scripting

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Nested loops in batch scripting

Reply to Message Icon

Name: madman7th
Date: January 25, 2005 at 12:07:45 Pacific
OS: Windows XP
CPU/Ram: 512MB
Comment:

So I'm trying to do a nested loop in a batch script:
FOR /d %%B in ("C:\Documents and Settings" "C:\Documents and Settings\*") DO CMD /C FOR /d %%C in ("%%B\Application Data\Mozilla\Firefox\Profiles" "%%B\Application Data\Mozilla\Firefox\Profiles\*") DO del /S /Q /F "%%C"\cache\*.*


This obviously doesn't work.

What am i doing wrong here?



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: January 25, 2005 at 12:26:59 Pacific
Reply:

Hi Andy,

One problem, separate from your batch, is that it's hard to tell where the line breaks are; bbcause of the way this forum wraps.

You may want to paste in your batch.

M2


0

Response Number 2
Name: madman7th
Date: January 26, 2005 at 09:26:59 Pacific
Reply:

Here's a URL. That should be formatted a little better.


0

Response Number 3
Name: Mechanix2Go
Date: January 26, 2005 at 20:54:46 Pacific
Reply:

Andy,

Where?

M2


0

Response Number 4
Name: madman7th
Date: January 27, 2005 at 09:10:53 Pacific
Reply:

http://home.mchsi.com/~a.choi/code.htm


0

Response Number 5
Name: Mechanix2Go
Date: January 28, 2005 at 04:36:58 Pacific
Reply:

Hi Andy,

No offense, but I can't make much sense of it.

It's got a fog index of about 6.5 on the Richter scale.

If what you need is to clean out those specific directorues, try this:

::=== cache cleaner
subst w: c:\mozilla\cache
del /s /q w:\
::==== you can guess the rest

But, as with any automated deletion, a little caution goes a long way.

So if you're going to use w: as above, put this line BEFORE the subst:

if exist w:\nul goto :error

And near the end, AFTER the substs & deletes:

:error
@echo off
echo W is already in use. Nothing done.


M2


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

GWBASIC program not getti... Batch File Problems W2k



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Nested loops in batch scripting

Nested loop in batch file help www.computing.net/answers/programming/nested-loop-in-batch-file-help/19396.html

FOR Loop in Win2K Script www.computing.net/answers/programming/for-loop-in-win2k-script/9942.html

batch script www.computing.net/answers/programming/batch-script/14086.html