Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Copy Path and Line
Copy Path and Line

Copy Path and Line

Nick Harrington

|
5 installs
| (0) | Free
Adds "Copy full path and line number" and "Copy relative path and line number" commands to the text editor context menu.
Download

Copy Path and Line

Instantly copy a file's path and line number to the clipboard — right from the editor context menu.

Features

Right-click anywhere in an open source file to access two new commands:

Copy full path and line number — copies the absolute path and current line: C:\Dev\MyProject\src\Foo.cs (Line: 42)

Copy relative path and line number — copies the path relative to the open solution directory: src\Foo.cs (Line: 42)

  • Falls back to filename alone when no solution is open
  • Hidden automatically for unsaved (untitled) files
  • Optional Unix-style forward-slash paths for WSL, shell scripts, and CI environments

Usage

Right-click in any open source file → select Copy full path and line number or Copy relative path and line number.

Configuration

Open Tools → Options → Copy Path and Line → General:

Setting Default Description
Use Unix-style paths Off Forward slashes (/) instead of backslashes (\). Applies to both commands.

Keyboard Shortcuts

Bind either command via Tools → Options → Environment → Keyboard:

  • EditorContextMenus.CodeWindow.Copyfullpathandlinenumber
  • EditorContextMenus.CodeWindow.Copyrelativepathandlinenumber

Supported Versions

  • Visual Studio 2022 (17.x)
  • Visual Studio 2026 (18.x)
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft