Windows/symlink: Difference between revisions

From Omnia
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
== symlinks ==
== symlinks ==
Make file link: (NOTE: parameters backwards from linux 'ln' command!')
mklink [link] [target]


Make directory link
Make directory link
mklink /d <link_name> <target_path>
  mklink /d [link] [target]
  mklink /d [link] [dest]


== cygwin / msys2 ==
== cygwin / msys2 ==

Revision as of 21:22, 23 November 2026

Make file link: (NOTE: parameters backwards from linux 'ln' command!')

mklink [link] [target]

Make directory link

mklink /d [link] [target]

cygwin / msys2

Set MSYS to use native symlinks instead of deepcopy (default):

setx /M MSYS "winsymlinks:nativestrict"
ln -s <target_path> <link_name>
ln -s [dest] [link]

(doesn't need sudo - I thought it did??)

winsymlinks:nativestrict

Symlinks - MSYS2
https://www.msys2.org/docs/symlinks/

winsymlinks:nativestrict is an option for the CYGWIN or MSYS environment variable that forces symbolic links to be created strictly as native Windows symlinks, failing immediately if a native symlink cannot be created

  • No fallback: Unlike winsymlinks:native (which falls back to Cygwin-style/shortcut symlinks on failure) or MSYS2's default winsymlinks:deepcopy (which copies files), nativestrict errors out immediately when native symlink creation fails.
  • Where it is set: Configure it via CYGWIN=winsymlinks:nativestrict in Cygwin or MSYS=winsymlinks:nativestrict in MSYS2.

keywords