Windows/symlink: Difference between revisions
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== symlinks == | == symlinks == | ||
Symlink support in Windows existed since Windows Vista, but creating them was initially only possible with administrator accounts. Starting with Windows 10 (~2016) it is possible to create symlinks with your normal user account if you have the "Developer Mode" enabled. Existing symlinks that were created by an administrator account, or with the "Developer Mode" enabled, can be used and deleted by normal users without the right to create symlinks themselves. <ref>https://www.msys2.org/docs/symlinks/</ref> | |||
NOTE: it looks like turning on 'sudo' counts as turning on developer mode! | |||
Make file link: (NOTE: parameters backwards from linux 'ln' command!') | Make file link: (NOTE: parameters backwards from linux 'ln' command!') | ||
| Line 18: | Line 22: | ||
ln -s [dest] [link] | ln -s [dest] [link] | ||
( | NOTE: If you turn on 'developer mode' or 'sudo' mode, you can run these without being in 'administrator' mode (and without actually having to run sudo)... | ||
=== winsymlinks:nativestrict === | === winsymlinks:nativestrict === | ||
Latest revision as of 21:26, 23 November 2026
symlinks
Symlink support in Windows existed since Windows Vista, but creating them was initially only possible with administrator accounts. Starting with Windows 10 (~2016) it is possible to create symlinks with your normal user account if you have the "Developer Mode" enabled. Existing symlinks that were created by an administrator account, or with the "Developer Mode" enabled, can be used and deleted by normal users without the right to create symlinks themselves. [1]
NOTE: it looks like turning on 'sudo' counts as turning on developer mode!
Make file link: (NOTE: parameters backwards from linux 'ln' command!')
mklink [link] [target]
# Powershell version: New-Item -ItemType SymbolicLink -Path link -Target 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]
NOTE: If you turn on 'developer mode' or 'sudo' mode, you can run these without being in 'administrator' mode (and without actually having to run sudo)...
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.