Link to home
Start Free TrialLog in
Avatar of kbay808
kbay808Flag for United States of America

asked on

How to create a batch or vbs file to delete all the system files in a folder?

I'm trying to create a script that will delete all of the files in the below folder.
C:\Users\[Current User]\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content

I tried this with no success.
del /f /q "%userprofile%\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content\*."
Avatar of Bill Prew
Bill Prew

That would only delete files with no extension, try:

del /f /q "%userprofile%\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content\*.*"

~bp
Avatar of kbay808

ASKER

I tried that, but it did not work for system files.  Please see the attached screen shot.
Screen-Shot.JPG
You may need to run this with elevated administrator privileges.

~bp
Avatar of kbay808

ASKER

I tried to run it as an administrator, but no joy.  I even tried it on a test file on my desktop and still no joy.  I attached a copy of the test file.

@echo off 
del /f /q "%userprofile%\Desktop\Test Delete\*."

Open in new window

Test-Delete.zip
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

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
Avatar of kbay808

ASKER

Thanks!!!   That worked great!!!