Print “Hello World” In PowerShell

PowerShell is new generation programming and scripting language. The PowerShell is mainly used to manage Windows systems and operating systems. The PowerShell provides a lot of commands in order to manage the Windows system. PowerShell uses a different term for commands which is named command or cmdlet. The “Hello World” is a popular term and example used when starting to learn a programming language. PowerShell can be also used to print “Hello World” into the PowerShell command-line interface.

Print Hello World In PowerShell

The Write-Host is the command used to print or write to the different outputs like standard output, file, registry, etc. By default the Write-Host command prints to the standard output. The “Hello World” is provided as a parameter to this command. Using single or double quotes is the better way to print “Hello World”.

Write-Host 'Hello, World!'
Print Hello World In PowerShell

Alternatively we can use double quotos in order to print “Hello World” in to the standard output.

Write-Host "Hello, World!"
Write-Host “Hello, World!”

Print Hello World In MS-DOS with PowerShell

The PowerShell is a very powerful scripting language that can be also called MS-DOS. The “Hello World” can be printed inside the MS-DOS (cmd.exe). The PowerShell.exe or PowerShell can be called via the MS-DOS and the -Command option is used to specify the command we want to run as a PowerShell command.

PowerShell -Command "Write-Host 'Hello World'"
Print Hello World In MS-DOS with PowerShell
See also  PowerShell Remove-Item Command Tutorial

Leave a Comment