Junction - Sysinternals | Microsoft Learn

Title: Junction v1.07 — Summary Author: Mark Russinovich Published: July 4, 2016

Summary:

  • Junction is a Sysinternals utility that creates and inspects NTFS junction points (directory aliases) on Windows 2000 and later. It was written because Windows lacked a built-in free tool for creating junctions (the Windows 2000 Resource Kit included linkd).

  • Junction works with NTFS reparse points (the mechanism for junctions). Note: Windows does not support junctions that target directories on remote shares.

  • Main capabilities:

    • Query a file or directory to determine whether it is a reparse point/junction (optionally recursively).

    • Create a junction directory that points to a target directory.

    • Delete a junction.

  • Syntax and parameters:

    • Query: junction.exe [-s] [-q]

    • Create: junction.exe

    • Delete: junction.exe -d

    • Parameters: -s (recurse subdirectories), -d (delete), -q (quiet), plus positional path arguments.

  • Examples:

    • Check a path: junction c:\test

    • List junctions under a directory recursively: junction -s c:\

    • Create a junction named c:\Program-Files for "c:\Program Files": junction c:\Program-Files "c:\Program Files"

    • Delete that junction: junction -d c:\Program-Files

  • Return codes:

    • 0 on success

    • -1 on failed creation of a new junction

    • Some operations that fail (e.g., deletion or checks when a file is not found) also return 0 according to the documentation.

  • Download: Junction.zip (504 KB) — link provided in original article.

  • Supported platforms (per article): Client: Windows Vista+, Server: Windows Server 2008+, Nano Server: 2016+.

Last updated in the article: 09/29/2022.