Initial commit with design and layout files
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
# Als PowerShell het script blokkeert
|
||||
|
||||
Windows weigert standaard `.ps1`-bestanden uit te voeren. Je krijgt dan:
|
||||
|
||||
```
|
||||
... is not digitally signed. You cannot run this script on the current system.
|
||||
```
|
||||
|
||||
Dit ligt niet aan het script. Hieronder drie oplossingen, van makkelijk naar
|
||||
hardnekkig.
|
||||
|
||||
---
|
||||
|
||||
## 1. Dubbelklik `download-images.cmd`
|
||||
|
||||
Die wrapper start PowerShell met `-ExecutionPolicy Bypass` voor dat ene proces.
|
||||
Verder verandert er niets aan je systeem.
|
||||
|
||||
## 2. Zet de policy om voor alleen dit venster
|
||||
|
||||
```powershell
|
||||
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
|
||||
.\download-images.ps1
|
||||
```
|
||||
|
||||
`-Scope Process` geldt tot je het venster sluit. Je hebt hier geen
|
||||
administratorrechten voor nodig.
|
||||
|
||||
Komt het bestand uit een zip die je van internet hebt gehaald, dan kan ook de
|
||||
"Mark of the Web" meespelen. Die haal je er zo af:
|
||||
|
||||
```powershell
|
||||
Get-ChildItem -Recurse ..\ | Unblock-File
|
||||
```
|
||||
|
||||
## 3. Inline, zonder scriptbestand
|
||||
|
||||
De execution policy geldt voor scriptbestanden, niet voor commando's die je
|
||||
zelf intypt of plakt. Deze variant werkt dus ook als je policy via Group Policy
|
||||
is vastgezet en je hem niet mag wijzigen.
|
||||
|
||||
Plak dit in PowerShell, vanuit de `scripts`-map:
|
||||
|
||||
```powershell
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$imgDir = Join-Path (Split-Path $PWD -Parent) 'assets\img'
|
||||
|
||||
Get-Content (Join-Path $imgDir 'manifest.txt') | ForEach-Object {
|
||||
$line = $_.Trim()
|
||||
if ($line -and -not $line.StartsWith('#')) {
|
||||
$parts = $line -split '\s+', 2
|
||||
$target = Join-Path $imgDir $parts[0]
|
||||
if (Test-Path $target) {
|
||||
Write-Host " overslaan $($parts[0])"
|
||||
} else {
|
||||
Write-Host " ophalen $($parts[0])"
|
||||
try { Invoke-WebRequest -Uri $parts[1] -OutFile $target -UseBasicParsing -TimeoutSec 30 }
|
||||
catch { Write-Host " MISLUKT $($parts[0])" -ForegroundColor Red }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Helemaal geen PowerShell?
|
||||
|
||||
Heb je Git for Windows of WSL, gebruik dan gewoon de bash-versie:
|
||||
|
||||
```bash
|
||||
bash scripts/download-images.sh
|
||||
```
|
||||
|
||||
En als laatste redmiddel: `assets/img/manifest.txt` is leesbaar met het blote
|
||||
oog. Elke regel is `<bestandsnaam> <URL>`. Je kunt de dertig afbeeldingen ook
|
||||
met de hand opslaan in `assets/img/` onder de naam die links staat.
|
||||
Reference in New Issue
Block a user