Get-childitem -recurse -file | Unblock-file 'link' (2026)

If a file is locked by another process (e.g., an executable currently running), Unblock-File will throw a non-terminating error and continue to the next file. To suppress these errors or log them, standard error redirection can be utilized:

Get-ChildItem -Recurse -File | Unblock-File -Verbose get-childitem -recurse -file | unblock-file

To unblock all files within the current directory and all subdirectories, the command is executed as follows: If a file is locked by another process (e

$blockedFiles | Select-Object FullName, LastWriteTime an executable currently running)

: Ensures only actual files—not directories—are passed down the pipeline. | (The Pipe) : Sends the list of files to the next command.