I am trying to delete a folder with subfolders/files.
Remove-Item -Force -Recurse -Path $directoryPath
I am getting the error Cannot remo
File is open in another program
I forgot that I had Visual Studio open with my project open and was getting this error.
Close any files associated with that directory, run PowerShell as admin, then run the command:
Remove-Item "C:\path\to\dir" -Recurse -Force
Pro Tip
You can also run this command to open file explorer:
ii "C:\path\to\dir"
If you right click and try to delete it, it might give you a more verbose error than command line.