Skip to content

Instantly share code, notes, and snippets.

@ForNeVeR
Created June 1, 2026 23:12
Show Gist options
  • Select an option

  • Save ForNeVeR/053e3f0b2bf9bc12145ceca6a4b45f29 to your computer and use it in GitHub Desktop.

Select an option

Save ForNeVeR/053e3f0b2bf9bc12145ceca6a4b45f29 to your computer and use it in GitHub Desktop.
Repro for symlink problems on Windows' ReFS
param (
$Disk = "W:\",
$Base = "$Disk\symlinks_1",
$Base2 = "$Disk\symlinks_2"
)
New-Item -Type Directory -Path "$Base/Versions/A" -Force | Out-Null
Set-Content -Path "$Base/Versions/A/OSLog.tbd" -Value "This is OSLog.tbd"
cmd /c mklink "$Base\Versions\Current" "A"
cmd /c mklink "$Base\OSLog.tbd" "Versions\Current\OSLog.tbd"
Get-Content "$Base\OSLog.tbd"
if ($?) {
Write-Host "Symlink 1 works correctly."
} else {
Write-Host "Symlink 1 does not work."
}
Move-Item $Base $Base2
Get-Content "$Base2\OSLog.tbd" -ErrorAction SilentlyContinue
if ($?) {
Write-Host "Symlink 2 works correctly."
} else {
Write-Warning "Symlink 2 does not work."
Write-Host "I will perform a fixup operation."
Write-Host "Get-ChildItem $Base2"
Get-ChildItem $Base2 | Out-Null
Write-Host "Get-ChildItem $Base2\Versions"
Get-ChildItem "$Base2\Versions" | Out-Null
Write-Host "Get-ChildItem $Base2\Versions\Current"
Get-ChildItem "$Base2\Versions\Current" | Out-Null
Get-Content "$Base2\OSLog.tbd" -ErrorAction SilentlyContinue
if ($?) {
Write-Host "Symlink 2 works correctly after fixup."
} else {
Write-Error "Symlink 2 still does not work after fixup."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment