Cmdlets And Parameters
Part of the PowerShell Basics section of Coddy's PowerShell journey. Lesson 4 of 28.
A cmdlet takes parameters: a dash, the parameter name, a space and the value. Parameters change what the cmdlet does.
Get-Date gives a date. With -Year, -Month and -Day it builds the date you ask for, and -Format turns it into text: yyyy is the year, MM the month, dd the day and dddd the weekday name.
Get-Date -Year 2025 -Month 12 -Day 25 -Format "yyyy-MM-dd"
Get-Date -Year 2025 -Month 12 -Day 25 -Format "dddd"2025-12-25
ThursdayJoin-Path joins a folder and a file name with the right separator, / on Linux and macOS:
Join-Path -Path "logs" -ChildPath "app.log"This prints logs/app.log. Parameter names are not case-sensitive, and the order of named parameters does not matter.
Challenge
EasyUse cmdlets with parameters to print facts about a report due on July 4, 2026.
- Print the date July 4, 2026 in the format
yyyy-MM-dd. - Print the weekday name of the same date.
- Print the path of the file
july.csvin the folderreports, built withJoin-Path.
Your script prints:
2026-07-04
Saturday
reports/july.csvTry it yourself
# 1. The date July 4, 2026 as yyyy-MM-dd
# 2. The weekday name of that date
# 3. The path of july.csv in the reports folder
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in PowerShell Basics
5Project: Password Checker
Project OverviewLength Check