& {
  $ErrorActionPreference = 'Stop'
  $repo = 'E:\FRAME_BACKUP'
  $parent = 'D:\FRAME\90_CACHE'
  $restoreDir = Join-Path $parent 'restore_test_A'
  $snapshot = 'SNAPSHOT_ID'
  if ($snapshot -eq 'SNAPSHOT_ID') { throw 'Insert a snapshot ID.' }
  if (!(Test-Path -LiteralPath "$repo\config")) { throw 'Repository is missing.' }
  if (!(Test-Path -LiteralPath $parent)) { throw 'Destination parent is missing.' }
  if (Test-Path -LiteralPath $restoreDir) { throw 'Destination exists.' }
  & restic.exe -r $repo restore $snapshot --target $restoreDir
  if ($LASTEXITCODE -ne 0) { throw 'Restore failed.' }
}
