Powershell: Find process that locks a file
Aus QBWiki
Version vom 18. Juni 2019, 08:18 Uhr von Pascal (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „ <syntaxhighlight lang="ps" line="1"> IF((Test-Path -Path $FileOrFolderPath) -eq $false) { Write-Warning "File or directory does not exist." } El…“)
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
}