Windows symbolic links and reparse points

Symbolic links are useful in any operating system to shorten long, complicated path names like C:/user/foo/data to just C:/data. If encountering problems with user permission, set user permission to create symbolic links on Windows.

Powershell symbolic link creation syntax:

New-Item -ItemType SymbolicLink -Path "Link" -Target "Target"

# for example:
New-Item -ItemType SymbolicLink -Path "my_program.exe" -Target "path/to/my_program.123.exe"

# also for directories:
New-Item -ItemType SymbolicLink -Path "my_fun_dir" -Target "path/to/my_dir"

For clarity, specify the full path to the target file or directory. Especially avoid target “.” or “..” as these can be confusing.

Symbolic links on Windows are a type of Reparse Points. fsutil can tell the type of reparse point:

fsutil reparsepoint query "my_fun_dir"

Reparse Tag Value : 0xa000000c

The reparse tag value corresponds to a symbolic link IO_REPARSE_TAG_SYMLINK.

Python test_symlink.py shows symlinks using Python standard library pathlib.

App Execution Alias

fsutil reparsepoint query $Env:LOCALAPPDATA/Microsoft/WindowsApps/wt.exe

Reparse Tag Value : 0x8000001b

The reparse tag value 0x8000001b is a Windows App Execution Alias IO_REPARSE_TAG_APPEXECLINK. App Execution Aliases are not symbolic links, but are a way for Windows CreateProcess to find the correct executable to run from a user-friendly name like “wt.exe” or “bash.exe”.

Not every language works with App Execution Aliases at this time–Java io and nio don’t work with App Execution Aliases currently. Python does work with App Execution Aliases, for example:

python -c "import shutil; print(shutil.which('wt.exe'))"

Unix-like shell

On a Unix-like shell including WSL, softlinks are created like:

ln -s target link