How to know which processes are using the specified file
The system will give an error when I try to delete it. Of course I know the command Stop-Process can help me kill the process. But I don't know which processes are using it. Can anybody tell me how the find the processes which are using the specified file?
PS:this is my powershell version:
1 Answer
1.How to Find Out Which Windows Process is Using a File (Process Explorer)
2.PowerShell method:
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
}3.WhoLockMe Explorer Extension v2.0 beta (NT-Win2K-XP) - Explorer extension which adds a right-click menu option