Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #The openfiles command needs to have support for local files enabled, by running openfiles /local on and restarting.
- $FileOrFolderPath = "C:\Temp\blaireau-mag-11042022.avi"
- 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
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement