A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Hello World in Powershell page! Here, you'll find the source code for this program as well as a description of how the program works.
Write-Host "Hello, World!"
Hello World in Powershell was written by:
This article was written by:
If you see anything you'd like to change or update, please consider contributing.
Let's get something working! 😊
To execute this code, open a PowerShell console on any Windows machine as it comes installed by default. You'll see the reply output in the window like so:
[20:35:40]:Alcha$ Write-Host 'Hello, World!'
Hello, World!
[20:35:56]:Alcha$
As is the case with most modern scripting languages, getting a Hello World sample running is really easy.
Instead of running the commands directly within the console though, write your scripts in a file and call the file when necessary. Download a copy of the HelloWorld.ps1 file from the repository and open a console.
Now, navigate to wherever you downloaded the script and execute it by calling it like so:
.\HelloWorld.ps1
This calls the script and returns the output to the console:
[20:35:40]:powershell$ .\HelloWorld.ps1
Hello, World!
[20:35:56]:powershell$
And, that's it!