DEV Community

Yuki Kimoto - SPVM Author
Yuki Kimoto - SPVM Author

Posted on

Windows Command Prompt Tutorial for Perl 2022

Explains how to use Windows Command Prompt to run Perl. Command Prompt is a CLI tool to run programs on Windows.

This article is originally Windows Command Prompt Tutorial | Perl ABC.

Execution of Command Prompt

Let's execute Command Prompt.

"Start Menu" | "Apps" | "Windows System Tools" | "Command Prompt"

Your home directory is shown on Command Prompt.

C:\Users\kimot

Showing File Extensions

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.

How to Make Windows Show File Extensions

Execution of Notepad

Perl programs are text files. You can create your Perl programs using Notepad.

The way to use Notepad is described in the following page.

11 ways to start Notepad in Windows

Creating Perl Programs

Let's create a Perl program.

Create a file named "start.pl" at your home directory.

C:\Users\kimot\start.pl

And write the following text.

print "Hello World";

And save it.

Runing Perl Programs

You can run your Perl program using perl command.

perl start.pl

The output is:

Hello World

Commands of Command Prompt

Intorduce offten used commands of Command Prompt.

dir

The "dir" command displays the list of files.

dir

cd

The "cd" command changes the working directory.

cd DirectoryName

".." is the file name that means the folder one level higher.

cd ..

Changing Drives

You can change drives using "c:" or "d:".

c:
d:

Seeing Command Histories

You can see command histories using "↑" and "↓" keys.

↑
↓

Getting Environment Variables

You can get and show a environment variable as the following.

echo %PATH%

Setting Environment Variable

You can set a environment variable as the following.

SET DATE=20080604

Top comments (1)

Collapse
 
davehodg profile image
Dave Hodgkinson

Let me put in a word for VSCode. It’s converted me from emacs.