# Where Am I? Get-Location and Paths

Get-Location tells you which folder PowerShell is working in, and the path it prints is that folder's full address, from the drive letter down through every folder to the one you're in.

Novice · PowerShell · Operating System · Updated November 10, 2026

## After this lesson you can

- Find the folder you're in with Get-Location
- Read a Windows path as a drive, then folders, from left to right

## Key takeaways

- PowerShell is always working in one folder, its current folder. `Get-Location` prints that folder's path.
- A path is an address read from left to right, from the drive (`C:`) through each folder, with `\` between them.
- A path that starts with a drive letter is an absolute path. It points to the same place wherever you are.
- `~` and `$HOME` both mean your home folder: `C:\Users\` followed by your user name.

A friend sends you a photo, you click **Save**, and it's gone. It's somewhere on your computer, but where? In File Explorer you'd click through Downloads, Documents and Pictures until it turns up. PowerShell starts somewhere better: it tells you exactly where you are, in one command, as an address you can read. Every PowerShell job starts with that address, whether it's a tutorial that says "open PowerShell in your project folder" or an IT help-desk tech asking "which folder are you in right now?"

## First, a practice folder

This chapter works in a folder of made-up vacation files, so nothing you try can touch your real ones. Copy these lines into PowerShell and press Enter. They make a folder called `trip` inside your home folder, with a folder for each day of a three-day trip, some pretend photos (empty files with photo names) and a few notes. Running them again is safe: they make the same folder again.

```powershell
New-Item -ItemType Directory -Force -Path "$HOME\terminal-practice\trip\day-1-beach", "$HOME\terminal-practice\trip\day-2-old-town", "$HOME\terminal-practice\trip\day-3-mountains\waterfall" | Out-Null
New-Item -ItemType File -Force -Path "$HOME\terminal-practice\trip\day-1-beach\sunset.jpg", "$HOME\terminal-practice\trip\day-1-beach\sandcastle.jpg", "$HOME\terminal-practice\trip\day-2-old-town\clock-tower.jpg", "$HOME\terminal-practice\trip\day-3-mountains\summit.jpg", "$HOME\terminal-practice\trip\day-3-mountains\waterfall\falls.jpg" | Out-Null
Set-Content -Path "$HOME\terminal-practice\trip\itinerary.txt" -Value 'Day 1: the beach. Swim, build a sandcastle, watch the sunset from the pier.', 'Day 2: the old town. The market in the morning, the clock tower at noon.', 'Day 3: the mountains. Hike to the summit, stop at the waterfall on the way.'
Set-Content -Path "$HOME\terminal-practice\trip\packing-list.txt" -Value 'Sunscreen', 'Swimsuit', 'Hiking boots', 'Rain jacket', 'Phone charger', 'Camera'
Set-Content -Path "$HOME\terminal-practice\trip\day-1-beach\beach-notes.txt" -Value 'The tide pool by the pier was full of tiny crabs.'
Set-Content -Path "$HOME\terminal-practice\trip\day-2-old-town\market-notes.txt" -Value 'The fruit stand at the market sells peaches for 50 cents each.'
Set-Content -Path "$HOME\terminal-practice\trip\day-3-mountains\trail-map.txt" -Value 'Trail to the summit: 3 miles up.', 'The waterfall is halfway, on the left.'
Set-Content -Path "$HOME\terminal-practice\trip\budget.txt" -Value 'Trip budget: $600. Spent so far: $412.' -Force
Set-ItemProperty -Path "$HOME\terminal-practice\trip\budget.txt" -Name Attributes -Value Hidden
```

The commands print nothing when they work. You don't need to understand them yet: `New-Item` makes folders and files, `Set-Content` writes text into a file, and Module 2 teaches both. `$HOME` stands for your home folder; you'll meet it again below.

## Where am I? Get-Location

A PowerShell window is always "in" one folder, the way you're always standing in one room of a house. That folder is the **current folder** (Windows also calls it the *current directory*): when you name a file without saying where it is, PowerShell looks for it here. To ask which folder that is, run `Get-Location`:

```powershell
Get-Location
```

```text
Path
----
C:\Users\Sam
```

PowerShell answers with a small table: a column called `Path`, and the path of the folder you're in. Yours shows your own user name instead of `Sam`. A new PowerShell window starts in your home folder, the folder Windows keeps for your account, with Documents, Downloads and Pictures inside it. The prompt shows the same thing, `PS C:\Users\Sam>`, so you'll often know where you are without asking.

The name says what it does: *get* the *location*. Its short name is `pwd`, from *print working directory*, which is what the same command is called on a Mac or in Linux.

## Reading a path like an address

A street address gets more exact from one part to the next: the country, the city, the street, the house. A **path** is the same kind of address for a folder or a file. Here is the address of the waterfall folder you made:

```text
C:\Users\Sam\terminal-practice\trip\day-3-mountains\waterfall
```

Read it from left to right:

- **`C:`** (read "C drive") is the **drive letter**: which disk the folder is on. Most computers keep everything on `C:`; a USB stick shows up as another letter, such as `D:`.
- **`\`** (read "backslash") separates one folder from the next, like the commas in an address.
- **`Users`, `Sam`, `terminal-practice`, `trip`, `day-3-mountains`** are folders, each one inside the one before it.
- **`waterfall`**, the last part, is where the address arrives.

A path that starts with a drive letter is an **absolute path**: it names the whole route, so it points to the same place wherever you are, the way a full address works from any city.

![A path drawn as a street address: C: is the country, each folder a smaller place inside it, and the last folder is the house the address arrives at](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/4f9ff25abbd94e92a64dc70e17f52c64.webp)

## Home: ~ and $HOME

Your home folder's path comes up so often that PowerShell has two short ways to write it. `~` (read "tilde", or "home") means your home folder in a path, and `$HOME` (read "dollar home") holds its path, ready to print:

```powershell
$HOME
```

```text
C:\Users\Sam
```

That's why the practice-folder lines above wrote `"$HOME\terminal-practice\trip"`: they work for every user name, yours included.

**On a Mac or Linux**, PowerShell 7 works the same way, but a path has no drive letter and uses `/`: your home folder is `/Users/sam` on a Mac and `/home/sam` on Linux, and on Linux capital letters matter in file names (`Photos` and `photos` are two folders; a Mac usually treats them as one). On Windows, PowerShell accepts `/` as well as `\`, so `C:/Users/Sam` finds the same folder. Windows PowerShell 5.1 runs everything in this lesson the same way.

**Try it.** Run `Get-Location`, then look at the prompt. Is it the same path? Then say your own home folder's path out loud, one part at a time.

## Try it in the terminal

[Terminal Quest: The Lighthouse, goal 1](https://www.ask-codey.com/games/terminal-quest/lighthouse/powershell/step): played right on the lesson page.

A storm has put the lighthouse lamp out, and ships are on their way. Your first job: find out where you are.

## Check yourself

2 questions to try on the lesson page.

## So what

Every command you run happens *somewhere*. Knowing where you are, and reading the address PowerShell gives you, is the first step to finding any file on any computer.

## Key terms

- [Get-Location](https://www.ask-codey.com/glossary/get-location)
- [Current Directory](https://www.ask-codey.com/glossary/current-directory)
- [Path](https://www.ask-codey.com/glossary/path-powershell)
- [Drive Letter](https://www.ask-codey.com/glossary/drive-letter)
- [Absolute Path](https://www.ask-codey.com/glossary/absolute-path)

## Cheat sheets

- [Where Am I? Get-Location and Paths](https://www.ask-codey.com/cheat-sheets/powershell-where-am-i-cheat-sheet)

## Related

- [Looking Around: Get-ChildItem](https://www.ask-codey.com/lessons/powershell-looking-around)
- [Moving Around: Set-Location, .. and Tab](https://www.ask-codey.com/lessons/powershell-moving-around)

Source: https://www.ask-codey.com/lessons/powershell-where-am-i
