Computing.Net > Forums > Programming > trouble with a bat file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

trouble with a bat file

Reply to Message Icon

Name: JohnFL
Date: July 18, 2006 at 04:35:19 Pacific
OS: Windows XP Home
CPU/Ram: Pent 3.0/2gigs
Product: Gigabyte
Comment:

I have a batch file i wrote, that i want to use whenever i get ready to do a backup of my drive C to drive D. I want to delete some temp files in my "Documents and Settings" folder.

c:
cd\documents and settings\owner\cookies\
del *.* /Q
c:
cd\documents and settings\owner\local settings\temp\
del *.* /Q
c:
cd\documents and settings\owner\local settings\temporary internet files\
del *.* /Q
c:

The first two instructions work fine, but the last one wont co-operate. This is my first time at doing this kind of stuff, so please go easy on the flames.

none



Sponsored Link
Ads by Google

Response Number 1
Name: uli_glueck
Date: July 18, 2006 at 04:55:27 Pacific
Reply:

Maybe it helps to set the path in double quotes:

cd /d "c:\documents and settings\owner\cookies\"
del *.* /Q

cd /d "c:\documents and settings\owner\local settings\temp\"
del *.* /Q

cd /d "c:\documents and settings\owner\local settings\temporary internet files\"
del *.* /Q
c:

uli


0

Response Number 2
Name: JohnFL
Date: July 18, 2006 at 05:10:31 Pacific
Reply:

Thanks for the comments uli_glueck, but that didn't seem to do anything either. I am suspecting that maybe that area is protected by windows, and won't let me delete them.

By the way, you say to start the line with cd /d what is the /d for?


none


0

Response Number 3
Name: uli_glueck
Date: July 18, 2006 at 05:21:08 Pacific
Reply:

cd "c:\documents and settings\owner\cookies\"

won`t work.

I find it a bit more elegant than:

c:
cd "documents and settings\owner\cookies\"

uli


0

Response Number 4
Name: Shr0Om
Date: July 18, 2006 at 05:56:26 Pacific
Reply:

If you use the /d switch you will change drive aswell as the dir.
It means you dont have to write C:
after or before you do:
Cd "c:\documents and settings\user"
run cmd and type: cd /? for info

Now, the reason you get an error could be as you stated because the files there are hidden or protected by windows. Possible because they migth be in use of iexplorer.
Try enter that path in cmd and write DIR to see if you can view the files. If not try to write

attrib -h -r -s /d *.*
This should clear any Read only, hidden or system file attribute on the files.
You now should be able to delete em.

If you need more info on commands just type "command/?" in cmd.


0

Response Number 5
Name: Mechanix2Go
Date: July 18, 2006 at 15:57:50 Pacific
Reply:

You don'y need to change directories to delete.

In fact, it's usually a bad idea.

Just do this:

del "c:\documents and settings\owner\cookies"


=====================================
If at first you don't succeed, you're about average.

M2



0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






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: trouble with a bat file

can I block a port with a Bat file www.computing.net/answers/programming/can-i-block-a-port-with-a-bat-file/15905.html

I need a .bat file! www.computing.net/answers/programming/i-need-a-bat-file/16333.html

Bat File Help www.computing.net/answers/programming/bat-file-help-/9414.html