Created
February 7, 2021 10:58
-
-
Save pirafrank/3f8859bc2d7f2728ded65cd1142327c5 to your computer and use it in GitHub Desktop.
PowerShell script to create NTFS symlinks on Windows. It uses UNIX-like args placement.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function print($str) { | |
Write-Host "$str" | |
} | |
if ( $($args.Count) -ne 2 ) { | |
$scriptName = $MyInvocation.MyCommand.Name | |
print("Usage: .\$scriptName target symlink_name") | |
exit | |
} | |
$shortcutTarget=$args[0] | |
$shortcutName=$args[1] | |
New-Item -itemtype symboliclink -path . -name $shortcutName -value $shortcutTarget |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment