Deletion of temporary files from PC

Archies

Board Regular
Joined
Aug 12, 2012
Messages
55
Hi,

I have created a batch process which is somehow not working for Temporary Internet Files.
Below is the code:
@echo off
rmdir /q /s "%USERPROFILE%\Local Settings\Temp\"
DEL /F /Q /S "%USERPROFILE%\Local Settings\Temporary Internet Files\*.*" > null

Can we have something similar to this in macro?

Regards,
Archies
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi,

I have created a batch process which is somehow not working for Temporary Internet Files.
Below is the code:
@echo off
rmdir /q /s "%USERPROFILE%\Local Settings\Temp\"
DEL /F /Q /S "%USERPROFILE%\Local Settings\Temporary Internet Files\*.*" > null

Can we have something similar to this in macro?

Regards,
Archies
Try this
Sub deleteFiles()
Dim myPath
myFolder = "C:\Temp"
Set Fso = CreateObject("Scripting.FileSystemObject") ' Get a File object to query.
Set Fldr = Fso.GetFolder(myFolder)
For Each Filename In Fldr.Files
Filename.Delete True ' delete all files
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,225,651
Messages
6,186,185
Members
453,339
Latest member
Stu61

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top