Hello-World.ps1

PowerShell - Beginner - Example

What It Does

This script displays the text "Hello, World!" in your terminal. It is the simplest possible PowerShell script and is commonly used as a first example when learning a new programming language.

How to Use

  1. Open PowerShell on your computer
  2. Navigate to the folder where you saved the file
  3. Type the following command and press Enter:
.\Hello-World.ps1

Expected Output

When the script runs successfully, you will see the following text appear in your terminal:

Hello, World!

The Code

This script contains only one line of code:

Write-Host "Hello, World!"

The Write-Host command tells PowerShell to display text on the screen. The text inside the quotation marks is what gets displayed.