0
0
PowerShellscripting~15 mins

String concatenation in PowerShell - Mini Project: Build & Apply

Choose your learning style9 modes available
String concatenation
📖 Scenario: You are creating a simple script to combine parts of a person's name into a full name. This is like putting together pieces of a puzzle to see the whole picture.
🎯 Goal: Build a PowerShell script that creates a full name by joining first name, middle name, and last name using string concatenation.
📋 What You'll Learn
Create variables for first name, middle name, and last name with exact values.
Create a variable for a space character to use as a separator.
Concatenate the names with spaces in between using the + operator.
Print the full name to the console.
💡 Why This Matters
🌍 Real World
Combining strings is common when creating messages, file paths, or user information in scripts.
💼 Career
Knowing how to join strings helps automate report generation, logging, and user interface text in many IT and scripting jobs.
Progress0 / 4 steps
1
Create name parts
Create three variables called $firstName, $middleName, and $lastName with the exact values "John", "F.", and "Kennedy" respectively.
PowerShell
Need a hint?

Use the = sign to assign the exact strings to each variable.

2
Create space separator
Create a variable called $space and assign it the exact value of a single space character " ".
PowerShell
Need a hint?

Remember a space is just a string with one space character inside quotes.

3
Concatenate full name
Create a variable called $fullName that concatenates $firstName, $space, $middleName, $space, and $lastName using the + operator.
PowerShell
Need a hint?

Use the plus sign + to join strings together in PowerShell.

4
Print the full name
Write a line to print the variable $fullName to the console using Write-Output.
PowerShell
Need a hint?

Use Write-Output $fullName to show the full name on the screen.