# Moving Around: Set-Location, .. and Tab

Set-Location moves PowerShell into another folder, by a relative path from where you are or an absolute one from the drive, and .., ~ and Tab completion make every move shorter.

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

## After this lesson you can

- Move between folders with Set-Location, using relative and absolute paths
- Use .., ~ and Tab completion to move with fewer keystrokes

## Key takeaways

- `Set-Location` moves you into another folder, and the prompt changes to show where you are.
- A relative path starts from the folder you're in. An absolute path starts from the drive and works from anywhere.
- `..` means the folder you're inside of. `..\..` goes up two folders, and a path can go up and then down again.
- `Set-Location ~` takes you home, and `Set-Location -` takes you back to the folder you were in before.
- Type the start of a name and press Tab, and PowerShell finishes it, with quotes when the name has a space.

Almost every tutorial for a programming tool starts the same way: "go into your project folder, then run…". IT instructions do too: "go to the Logs folder and look at today's file". In File Explorer that's a string of double-clicks. In PowerShell it's one command, and once you know a few shortcuts it's faster than the clicks, even for a folder five levels down.

This lesson uses the `trip` folder from *Where Am I? Get-Location and Paths*.

## Going into a folder: Set-Location

`Set-Location` (read "set location") moves PowerShell into another folder: it changes the current folder. Give it the folder's path. Here, `~` means your home folder, so this works for every user name:

```powershell
Set-Location ~\terminal-practice\trip
Get-Location
```

```text
Path
----
C:\Users\Sam\terminal-practice\trip
```

The prompt changes too, to `PS C:\Users\Sam\terminal-practice\trip>`, so you can see where you are before you type the next command. From here, a folder inside `trip` needs only its name:

```powershell
Set-Location day-1-beach
Get-Location
```

```text
Path
----
C:\Users\Sam\terminal-practice\trip\day-1-beach
```

`day-1-beach` is a **relative path**: it starts from the folder you're in, the way "the second door on the left" only makes sense from where you're standing. The path that starts with `C:` is an **absolute path**: it works from anywhere. The short name for `Set-Location` is `cd`, from *change directory*.

## Up a level: ..

Two dots, `..` (read "dot dot"), mean "the folder I'm inside of", the **parent folder**. One step up:

```powershell
Set-Location ..
Get-Location
```

```text
Path
----
C:\Users\Sam\terminal-practice\trip
```

Steps join with `\`, so one path can go up and then down again. From deep in the mountains, this goes up two folders to `trip`, then down into the old town:

```powershell
Set-Location day-3-mountains\waterfall
Set-Location ..\..\day-2-old-town
Get-Location
```

```text
Path
----
C:\Users\Sam\terminal-practice\trip\day-2-old-town
```

![The trip folder as a tree: from waterfall, the first .. climbs to day-3-mountains, the second to trip, and then the path goes down into day-2-old-town](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/9a649945083e442794b1eb31966bdfae.webp)

## Home, and back again

`Set-Location ~` takes you home from anywhere. `Set-Location -` (a dash) takes you back to the folder you were in before, like a browser's Back button:

```powershell
Set-Location ~
Set-Location -
Get-Location
```

```text
Path
----
C:\Users\Sam\terminal-practice\trip\day-2-old-town
```

Windows PowerShell 5.1 doesn't have `Set-Location -`; everything else in this lesson works there too. On a Mac or Linux, write the paths with `/` (`../../day-2-old-town`), and type names with their exact capital letters.

## Let PowerShell type for you: Tab

Long names are slow to type, and every letter is a chance for a typo. Type the first few letters and press **Tab**: PowerShell fills in the rest of a name that's there. From `trip`, typing `Set-Location day-3` and pressing Tab gives:

```text
Set-Location .\day-3-mountains
```

`.\` (read "dot backslash") means "in the folder I'm in". When several names fit, such as `day` for all three day folders, press Tab again to go through them one at a time, and **Shift+Tab** to go back. If nothing appears, no name starts with what you typed: that's a typo caught before you press Enter.

A name with a space needs quotes, or PowerShell reads it as two words:

```powershell
Set-Location C:\Program Files
```

```text
Set-Location: A positional parameter cannot be found that accepts argument 'Files'.
```

With quotes, it works. Tab adds them for you: type `Set-Location C:\Program` and press Tab, and you get `'C:\Program Files'`.

```powershell
Set-Location 'C:\Program Files'
Get-Location
```

```text
Path
----
C:\Program Files
```

**Try it.** Starting from your home folder, go to the waterfall folder in as few keystrokes as you can: a few letters of each name, then Tab. Count the keys you pressed, then count the letters in the full path you'd otherwise have typed.

## Try it in the terminal

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

Get into the cottage, find Mara's diary and the brass compass, fetch the matches, search the shore and climb the tower. The game shows you how to read each note with `Get-Content`; the next lesson, *Reading Files: Get-Content*, explains it in full.

## Check yourself

2 questions to try on the lesson page.

## So what

Moving around is most of what you do in a terminal. With relative paths, `..`, `~` and Tab, any folder on the computer is a few keystrokes away.

## Key terms

- [Set-Location](https://www.ask-codey.com/glossary/set-location)
- [Relative Path](https://www.ask-codey.com/glossary/relative-path)
- [Absolute Path](https://www.ask-codey.com/glossary/absolute-path)
- [Parent Folder](https://www.ask-codey.com/glossary/parent-folder)
- [Tab Completion](https://www.ask-codey.com/glossary/tab-completion-powershell)

## Cheat sheets

- [Moving Around: Set-Location, .. and Tab](https://www.ask-codey.com/cheat-sheets/powershell-moving-around-cheat-sheet)

## Related

- [Where Am I? Get-Location and Paths](https://www.ask-codey.com/lessons/powershell-where-am-i)
- [Looking Around: Get-ChildItem](https://www.ask-codey.com/lessons/powershell-looking-around)
- [Reading Files: Get-Content](https://www.ask-codey.com/lessons/powershell-reading-files)

Source: https://www.ask-codey.com/lessons/powershell-moving-around
