8
0
Skriptentwickung/test/PS_Beispiel_Aufrufparameter.ps1
2024-01-24 16:42:38 +01:00

26 lines
1.6 KiB
PowerShell
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# PS_Beispiel_Aufrufparameter.ps1
# PS_Beispiel_Aufrufparameter.ps1 -a abc -b def -c ghi
# PS_Beispiel_Aufrufparameter.ps1 -b def -c ghi -a abc
# PS_Beispiel_Aufrufparameter.ps1 -b def -c ghi -a abc
# PS_Beispiel_Aufrufparameter.ps1 -paramA abc -paramB def -paramC ghi
# PS_Beispiel_Aufrufparameter.ps1 -paramA abc -paramB def -paramC ghi
Param(
# 'Mandatory' -> Ist dieser Wert erforderlich?
[parameter(Mandatory=$true)]
[alias("a")]
$ParamA,
[parameter(Mandatory=$true)]
[alias("b")]
$ParamB,
[parameter(Mandatory=$false)]
[alias("c")]
$ParamC
)
Write-Host "Parameter A = $ParamA"
Write-Host "Parameter B = $ParamB"
Write-Host "Parameter C = $ParamC"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Start-Sleep -m 10000