Menu
CoddyTech

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
Thursday

Join-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 icon

Challenge

Easy

Use cmdlets with parameters to print facts about a report due on July 4, 2026.

  1. Print the date July 4, 2026 in the format yyyy-MM-dd.
  2. Print the weekday name of the same date.
  3. Print the path of the file july.csv in the folder reports, built with Join-Path.

Your script prints:

2026-07-04
Saturday
reports/july.csv

Try 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
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in PowerShell Basics