DEV Community

Cover image for Getting Started with PowerShell: Your First Commands
arnostorg
arnostorg

Posted on

Getting Started with PowerShell: Your First Commands

Getting Started with PowerShell: Your First Commands

PowerShell seems intimidating, but you only need 5 commands to become productive. Let's start with the foundation.

How It Works

PowerShell is a command-line tool where you type commands instead of clicking. Each command does one job well. The prompt (>) waits for you to type commands.

Your first three commands answer basic questions: Where am I? What's here? How do I get there?

Code Examples

See Your Current Folder

# Ask PowerShell: where am I right now?
Get-Location

# Output: C:\Users\YourName

# Shortcut (same command):
pwd
Enter fullscreen mode Exit fullscreen mode

List What's in This Folder

# Ask PowerShell: what files and folders are here?
Get-ChildItem

# Output shows:
# Name            LastWriteTime      Length
# Documents       3/20/2026 10:15 AM
# report.txt      3/18/2026 2:45 PM  4521

# Shortcuts (same command):
ls
dir
Enter fullscreen mode Exit fullscreen mode

Move to a Different Folder

# Go into Documents folder
Set-Location Documents

# Now your prompt shows:
# PS C:\Users\YourName\Documents>

# Shortcut:
cd Documents

# Go back to parent folder
cd ..

# Go to your home folder
cd ~
Enter fullscreen mode Exit fullscreen mode

Create a New Folder

# Create a folder called "MyProject"
New-Item -ItemType Directory -Name "MyProject"

# Go into it
cd MyProject
Enter fullscreen mode Exit fullscreen mode

Most Used Options

  • pwd / Get-Location - See where you are right now
  • ls / Get-ChildItem - List files and folders here
  • cd / Set-Location - Move to different folder
  • cd .. - Go up one level
  • New-Item -ItemType Directory - Create a folder

The Trick: Power Usage

Combine commands to understand your location:

# See where you are
pwd

# See what's here
ls

# Now you're oriented!
Enter fullscreen mode Exit fullscreen mode

Tab completion saves typing: Type part of a path and press TAB:

cd Doc[TAB]  # Becomes: cd Documents
Enter fullscreen mode Exit fullscreen mode

Use this every timeโ€”saves hundreds of keystrokes!

Learn It Through Practice

Stop reading and start practicing:

๐Ÿ‘‰ Practice on your browser

The interactive environment lets you type these commands and see real results.

Part of PowerShell for Beginners

This is part of the PowerShell for Beginners series:

  1. Getting Started - Your first commands
  2. Command Discovery - Find what exists
  3. Getting Help - Understand commands
  4. Working with Files - Copy, move, delete
  5. Filtering Data - Where-Object and Select-Object
  6. Pipelines - Chain commands together

Related Resources

Summary

You now understand:

  • How this command works
  • The most useful options
  • One powerful trick
  • Where to practice hands-on

Practice these examples until they're automatic. Mastery comes from repetition.


Practice now: Head to the interactive environment and try these commands yourself. That's how PowerShell clicks for you!

What would you like to master next?

Top comments (0)