Created
June 2, 2018 13:01
-
-
Save csharpforevermore/2799e74e7b4d33d8177a6300d99c465a to your computer and use it in GitHub Desktop.
Is this folder in use and which application is locking the folder for me?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IF((Test-Path -Path $FileOrFolderPath) -eq $false) { | |
Write-Warning "File or directory does not exist." | |
} | |
Else { | |
$LockingProcess = CMD /C "openfiles /query /fo table | find /I ""$FileOrFolderPath""" | |
Write-Host $LockingProcess | |
} |
Feature must be enabled with this snippet first in Powershell openfiles /local on
(some versions of Windows may have issues with this command when running on a 64-bit machine, occasionally reporting the error message ERROR: The target system must be running a 32 bit OS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to the user frank from website SuperUser for his solution here