Link to home
Start Free TrialLog in
Avatar of JElster
JElsterFlag for United States of America

asked on

DOS Batch file

How can I write a BAT file to navigate to

%localappdata%\mydata

and delete the contents

I want to place the file on my WIndows 7 desktop
ASKER CERTIFIED SOLUTION
Avatar of Raghu Mutalikdesai
Raghu Mutalikdesai
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Create a new shortcut on the desktop and set this:

cmd.exe /c "echo rmdir /s /q %APPDATA%\mydata" && pause

and give it some useful name.

Note that the above command now only echos what it would delete and halts with a pause, it also deletes the mydata folder.

Also note that the above suggestions that use the del command do not remove subdirectories of mydata.

Do you want the 'mydata' folder removed as well or not?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@JElster - you've chosen 3 comments as your solution, all of them do not delete subfolders in your target folder. Which of the 3 are you working with now?
Avatar of JElster

ASKER

none.. I gave up
In that case, we should delete this question. I can do that for you if you like (or ask for Attention).
Avatar of Norm Dickinson
Norm Dickinson

The question has been marked as solved...so dropping it and moving on would also work? Just a thought.