Powershell: Find process that locks a file: Unterschied zwischen den Versionen

Aus QBWiki
Zur Navigation springenZur Suche springen
(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…“)
 
Zeile 3: Zeile 3:
  
  
<syntaxhighlight lang="ps" line="1">
+
<syntaxhighlight lang="ps" number="1">
 
IF((Test-Path -Path $FileOrFolderPath) -eq $false) {
 
IF((Test-Path -Path $FileOrFolderPath) -eq $false) {
 
     Write-Warning "File or directory does not exist."       
 
     Write-Warning "File or directory does not exist."       

Version vom 18. Juni 2019, 08:18 Uhr



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
}