From 4ada8f2fde90454f34a8566a0162cedf1f639c1e Mon Sep 17 00:00:00 2001 From: Calyx Hikari Date: Sun, 29 Jun 2025 13:09:52 +0800 Subject: [PATCH] Disable the script from running on non-Windows --- 32 | 5 +++++ 64 | 5 +++++ dx | 5 +++++ index.html | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/32 b/32 index be05d2f..3382fa2 100644 --- a/32 +++ b/32 @@ -3,6 +3,11 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem +if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') { + Write-Warning "Please run it on Windows. " + exit 1 +} + $flagPath = "$env:TEMP\elevation_success.flag" if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue } diff --git a/64 b/64 index 71e521f..28d6eca 100644 --- a/64 +++ b/64 @@ -3,6 +3,11 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem +if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') { + Write-Warning "Please run it on Windows. " + exit 1 +} + $flagPath = "$env:TEMP\elevation_success.flag" if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue } diff --git a/dx b/dx index 2be8cef..8ca74b6 100644 --- a/dx +++ b/dx @@ -3,6 +3,11 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem +if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') { + Write-Warning "Please run it on Windows. " + exit 1 +} + $flagPath = "$env:TEMP\elevation_success.flag" if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue } diff --git a/index.html b/index.html index 21f57b1..64be08e 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,11 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem +if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') { + Write-Warning "Please run it on Windows. " + exit 1 +} + $flagPath = "$env:TEMP\elevation_success.flag" if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }