Added the #requires statement

This commit is contained in:
Markus Fleschutz
2025-07-09 11:06:19 +02:00
parent acc0cbc8ff
commit d3e77308a8
8 changed files with 16 additions and 0 deletions

View File

@ -12,6 +12,8 @@
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Documents" -pathType container)) {

View File

@ -12,6 +12,8 @@
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Downloads" -pathType container)) {

View File

@ -12,6 +12,8 @@
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
$path = [Environment]::GetFolderPath('Fonts')
if (-not(Test-Path "$path" -pathType container)) {

View File

@ -12,6 +12,8 @@
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
if (-not(Test-Path "~" -pathType container)) { throw "No home directory at: $path" }
$path = Resolve-Path "~"

View File

@ -14,6 +14,8 @@
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
param([string]$folderName = "")
try {

View File

@ -12,6 +12,8 @@
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
if (Test-Path "~/Repos" -pathType container) { $path = "~/Repos"
} elseif (Test-Path "~/repos" -pathType container) { $path = "~/repos"

View File

@ -12,6 +12,8 @@
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
function GetCurrentUserSID { [CmdletBinding()] param()
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
return ([System.DirectoryServices.AccountManagement.UserPrincipal]::Current).SID.Value

View File

@ -12,6 +12,8 @@
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
if ($IsLinux -or $IsMacOS) { throw "This script requires a Windows operating system" }