I am using above power shall script to clear chrome cache.
I am able to clear up to some cache files but also getting below error.
Access to the path ‘C:\Users\Machinename\AppData\Local\Google\Chrome\User Data\Default\Cache\data_0’ is denied.
Access to the path ‘C:\Users\Machinename\AppData\Local\Google\Chrome\User Data\Default\Cache\data_1’ is denied.
data files are not able to clear.
Please help me to resolve this issue.
you are getting this error because Chrome is open. The powershell script will not work if Chrome is open. I would do a kill chrome before you start the clear cache. Also, in your script you will need a recurse.
I was getting an error as
“The item at C:\Users<Username>\AppData\Local\Google\Chrome\User Data\Default\Cache\Cache_Data has children and the Recurse parameter was not specified. If you continue, all children will be removed with the item. Are you sure you want to continue? —> System.Management.Automation.Host.HostException: A command that prompts the user failed because the host program or the command type does not support user interaction.”
This worked for me.
//The first line is if chrome is open it will kill it else it will still proceed with it.