I am trying to delete a folder with all the subfolder and contains. But there are jar files used by another process. So it fails. I tried:-
Remove-Item -LiteralPath "C:\tools\wlp-8.5.5.9\usr\servers\dev\workarea" -Force -Recurse
But it fails:-
Remove-Item : Cannot remove item C:\tools\wlp-8.5.5.9\usr\servers\dev\workarea\org.eclipse.osgi\142\0.cp\lib\cxf-core-3.0.3.jar: The process cannot access the file 'cxf-core-3.0.3.jar' because it is being used by another process.
How can I forcefully delete this folder by PowerShell script?