Working with Variables
Swipe um das Menü anzuzeigen
Variables in PowerShell allow you to store and reuse data throughout your scripts. When naming variables, follow these rules:
# Variable interpolation in PowerShell strings
$name = "Sam"
$message = "Welcome, $name!"
Write-Output $message # Output: Welcome, Sam!
- Start the name with a dollar sign (
$); - The first character after
$must be a letter or underscore; - Use only letters, numbers, and underscores in the name;
- Avoid spaces and special characters;
- Variable names are not case-sensitive.
Variable scope determines where a variable can be accessed. Most variables you create are local to your script or session, but you can specify other scopes like
global:orscript:if required.
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 3
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Abschnitt 1. Kapitel 3