1.

Solve : Help with bat file?

Answer»

This is my FIRST attempt to make a bat file. I'm using Windows XP and I've tried using cmd to get to the files but it keeps stopping at C:\Documents and Settings\MrPiggss\Desktop instead of going into the My Documents folder.

Basically I need to be able to delete all files within:

C:\Documents and Settings\MrPiggss\My documents\Battlefield Play4Free\WebCache

and all file and folders with:

C:\Documents and Settings\MrPiggss\My Documents\Battlefield Play4Free\mods\main

Can someone help me out with this?Why not use windows to delete the directory through my computer and or windows exployer (windows key + E)

Then select the directories you wish to delete and press the delete key?Quote from: MrPiggss on August 13, 2011, 02:29:52 PM

This is my first attempt to make a bat file. I'm using Windows XP and I've tried using cmd to get to the files but it keeps stopping at C:\Documents and Settings\MrPiggss\Desktop instead of going into the My Documents folder.

Basically I need to be able to delete all files within:

C:\Documents and Settings\MrPiggss\My documents\Battlefield Play4Free\WebCache

and all file and folders with:

C:\Documents and Settings\MrPiggss\My Documents\Battlefield Play4Free\mods\main

Can someone help me out with this?
cd WebCache

del /F *.*
cd ..
rd WebCache

@Rustys the reason I'd like a bat is because I have to clear these 2 folders every time to play a game. If I don't the game crashes. Rather than manually going through my computer yada yada yada... if I had a bat I COULD just double click it would be easier.

@DanCollins
do I need to specify the full location i.e. C:\Documents and Settings\MrPiggss\My documents\Battlefield Play4Free\WebCache or just do it as you have shown?Quote from: MrPiggss on August 13, 2011, 10:21:30 PM
DanCollins
do I need to specify the full location i.e. C:\Documents and Settings\MrPiggss\My documents\Battlefield Play4Free\WebCache or just do it as you have shown?

Code: [Select]@echo off
cd "C:\Documents and Settings\MrPiggss\My documents\Battlefield Play4Free\WebCache"

del /F *.*
cd ..
rd WebCache

cd "c:\Documents and Settings\MrPiggss\My Documents\Battlefield Play4Free\mods\main\"

del /F *.*
cd ..
rd main
The above code must be saved to a batch file, deleterm.bat. The batch file can then be executed from the COMMAND line.
(Or point to the batch file and double click.)

C:\test>deleterm.bat

p.s. Be careful when using *.* with delete. Make sure you have the correct files.
You may NAME the batch file any name you please: myfile.bat
"path" "" is necessary when there is OPEN space inside the path.


Discussion

No Comment Found