RelicRELIC
Developer copy and paste

How to copy a file path

Copying the full path to a file is a two-second job once you know the shortcut. Windows and Mac each have a built-in way, the terminal has its own commands, and a couple of small gotchas can still bite.

Jordan Gibbs June 29, 2026 5 min readUpdated July 1, 2026

A file path is just the address of a file: the exact list of folders you would walk through to reach it, written as one line of text. C:\Users\Sam\Documents\report.pdf on Windows, or /Users/sam/Documents/report.pdf on a Mac. You need to copy one more often than you would think: pasting it into a command, attaching it to a bug report, pointing a config file at it, or just telling a colleague exactly where something lives. The good news is that every operating system has a one-click or one-shortcut way to grab it. You rarely need to type a path by hand.

Copy a file path on Windows

Windows gives you a built-in option that copies the full path in one move, and it has been there since Windows 7. There is no need to install anything.

The Shift + right-click method (the reliable one)

  • Find the file or folder in File Explorer.
  • Hold Shift and right-click it.
  • Choose Copy as path from the menu.

That puts the complete path on your clipboard, wrapped in double quotes. The quotes are deliberate: they keep the path in one piece if it contains spaces, which matters the moment you paste it into a terminal. On Windows 11 you do not even need the Shift key any more. Right-click the file, open the menu, and Copy as path is right there.

The address bar method (no quotes)

If you want a folder path without the surrounding quotes, click into the address bar at the top of File Explorer. The friendly breadcrumb turns into the raw path, already highlighted. Press Ctrl+C and you have it. This copies the folder you are in rather than a specific file, so it is best when you need a directory.

Quick keyboard route: select the file, then press Ctrl+Shift+C in File Explorer on Windows 11 to copy its path without touching the mouse. On older Windows the Shift + right-click menu is the dependable choice.

Copy a file path on a Mac

macOS hides this behind a modifier key, which is why so many people think it is not possible. It is, and it is quick once you know the trick.

The Option-key method

  • Select the file in Finder.
  • Right-click (or two-finger tap on the trackpad) to open the menu.
  • Hold Option. The Copy entry changes to Copy as Pathname.
  • Click it. The full path is now on your clipboard.

Mac paths use forward slashes and start from the root, like /Users/sam/Documents/report.pdf. Unlike Windows, macOS does not add quotes, so if the path contains spaces you may need to wrap it yourself before pasting it into a command.

Drag into Terminal

There is an even faster way when the path is destined for a command line. Open Terminal, start typing your command, then drag the file from Finder straight into the Terminal window. macOS types the full, correctly escaped path for you, spaces and all. It is the most reliable way to get a path into a command without a single typo.

Copy a file path in the terminal

If you are already in a terminal, you usually want to print a path rather than copy it from a window. The commands differ by system, and so do the copy and paste shortcuts. We cover the full set of rules in our guide to copying and pasting in the terminal, but here is the short version.

  • macOS and Linux: run pwd to print your current folder, or realpath filename to print the full path to a specific file. On a Mac you can pipe it straight to the clipboard with pwd | pbcopy.
  • Windows PowerShell: Get-Location shows the current folder, and (Resolve-Path filename).Path | Set-Clipboard copies a file’s full path in one line.

One thing to remember in any terminal: Ctrl+C does not copy. It cancels the running command. To copy and paste in most terminals you use Ctrl+Shift+C and Ctrl+Shift+V instead. On a Mac Terminal, the normal Cmd+C and Cmd+V work as you would expect.

Full path, relative path, or just the file name?

The methods above all copy the full path, also called the absolute path, which starts at the drive or root and works from anywhere. Sometimes you want less than that.

  • Just the file name: click the file once to select it, press F2 (Windows) or Return (Mac) to enter rename mode, then Ctrl+C or Cmd+C. You get the name without the folders. Press Escape to leave rename mode without changing anything.
  • A relative path: this describes where a file sits compared to where you are, like ..\images\logo.png. There is no menu button for it. You usually build it by hand or let your code editor generate it when you import or link a file.

Common snags and how to fix them

  • The path broke at a space. A command read C:\My Files\a.txt as two separate things. Wrap the whole path in double quotes, which is exactly why Windows adds them for you.
  • Wrong slashes. Windows writes backslashes and Mac and Linux write forward slashes. If you move a path between systems, you may need to swap them. Many tools on Windows now accept either.
  • You copied the wrong thing. Copy as path grabs whatever is selected, so double-check the highlight before you copy, especially in a folder full of similar names.

None of this is hard, and once the shortcut is in your fingers you stop thinking about it. If you find yourself reaching for the same paths and commands over and over, a clipboard manager that keeps a searchable history saves you digging them out a second time.

Written by
Jordan GibbsFounder, Relic

Jordan Gibbs is the founder of Relic, an end-to-end encrypted, permanent, searchable memory for everything you copy. He writes widely about AI, agents, and practical tooling on Medium, where he is read by tens of thousands, and builds privacy-first software. Here he covers how everyday tools like the clipboard actually work, and how to use them without handing your data to someone else.

MediumGitHubLinkedIn
Part of
Developer copy and paste
Keep reading
Pillar·8 min

How to copy and paste in the terminal

Ctrl C cancels a command in the terminal, so copy and paste works differently there. Getting it right in Windows Terminal, macOS, Linux, tmux, Vim and over SSH.

Read
7 min

How to copy in cmd, accurately

Copying in the Windows command line is not like copying anywhere else, because Ctrl+C already cancels commands there. The classic cmd window, Windows Terminal, and the clip piping tricks.

Read
7 min

What is a UUID?

A UUID is a 128-bit value designed to be unique without any central authority handing it out. What they are, how the versions differ, and when to reach for one.

Read
developerhow-toproductivity