PowerShell(pwsh) is a CLI tool to run programs on Windows.
This article is originally PowerShell(pwsh) Tutorial for Perl | Perl ABC
- Linux/UNIX-like Shell
- ls, echo commands, etc
- A string is quoted "" and ''
PowerShell(pwsh) can be downloaded from the following page.
Click the following link to download PowerShell(pwsh).
And double-click the downloaded file. The installer is executed.
"Next" | "Next" | "Next" | "Install" | "Finish"
Let's execute PowerShell/pwsh.
"Start Menu" | "Apps" | "PowerShell" | "PowerShell 7 (x64)"
Your home directory is shown on PowerShell/pwsh.
The extension of Perl program is ".pl". It is useful if extensions of files are displayed.
The way to show file extensions is described in the following page.
Perl programs are text files. You can create your Perl programs using Notepad.
The way to use Notepad is described in the following page.
Let's create a Perl program.
Create a file named "start.pl" at your home directory.
And write the following text.
print "Hello World";
And save it.
You can run your Perl program using perl command.
The output is:
Introduce often used commands of PowerShell/pwsh.
The "ls" command displays the list of files.
The "cd" command changes the working directory.
".." is the file name that means the folder one level higher.
You can change drives using "c:" or "d:".
Set-Location -Path c: Set-Location -Path d:
You can see command histories using "↑" and "↓" keys.
Show environment variables.
You can get and show an environment variable as the following.
$env:MYENV = "This is my env."
You can set an environment variable as the following.