Skip to content

Instantly share code, notes, and snippets.

@supermarsx
Last active April 16, 2026 11:06
Show Gist options
  • Select an option

  • Save supermarsx/b299d0189f94905a4dd6463179ae0a93 to your computer and use it in GitHub Desktop.

Select an option

Save supermarsx/b299d0189f94905a4dd6463179ae0a93 to your computer and use it in GitHub Desktop.
Mass unblock files recursively on Windows

Mass Unblock Files Recursively on Windows

A tiny PowerShell snippet that removes the “blocked” Mark-of-the-Web (Zone.Identifier) flag from every file inside a folder tree—perfect after unzipping archives downloaded from the internet.

🖥️ The Script

Minimal, no progress output

Get-ChildItem -Path "C:\Your\Path\Here" -Recurse -File | Unblock-File

Verbose, with progress per file

Get-ChildItem -Path "C:\Your\Path\Here" -Recurse -File |
    ForEach-Object {
        Write-Host "Unblocking $($_.FullName)"
        Unblock-File $_
    }

Replace C:\Your\Path\Here with the root folder whose contents you want to unblock.

🚀 How to Use

  1. Save either snippet as unblock-files.ps1.

  2. Open PowerShell as Administrator (required if any files need elevated rights).

  3. Run the script, supplying the target path:

    .\unblock-files.ps1 -Path "C:\Users\<YourUser>\Downloads"

    Omit the -Path parameter if you hard-coded it in the script.

  4. Watch the progress variant echo each file as it’s unblocked.

🤔 Why Unblock?

Windows tags files from untrusted sources with a hidden Zone.Identifier ADS. Some executables or scripts refuse to run while this flag is present, and extracting a large ZIP can leave hundreds of files in this state. These one-liners clear the flag in one pass instead of using Right-click → Properties → Unblock on each file.

🔒 Safety Tip

Always scan unfamiliar downloads with your antivirus before unblocking them. Removing the Mark-of-the-Web makes Windows treat the files as local and trusted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment