Created
September 30, 2017 06:25
-
-
Save ndunks/a3dfa7d301457fbad34017324b43fcc8 to your computer and use it in GitHub Desktop.
Windows 10 Add Copy-Paste as Symbolic Link or Junction
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
# Add windows Explorer Right-Click menu to paste copied item as Junction or SymbolicLink with PowerShell | |
# Locate file on C:\CMD\ | |
param ( | |
[Parameter(Mandatory=$true)][string]$location | |
) | |
Set-Location $location | |
$files = Get-Clipboard -Format FileDropList | |
$count = $files.count; | |
if($count -eq 0) | |
{ | |
echo "No file(s) in clipboard" | |
pause | |
exit | |
} | |
echo "Making Junction/Link of $count files" | |
foreach ($file in $files) | |
{ | |
if( (Test-Path $file.Name) -eq $true ){ | |
echo "$($file.Name) Exists" | |
}else{ | |
if($file.Attributes -eq 'Directory') | |
{ | |
#echo "Junction: $($file.Name) -> $file" | |
New-Item -ItemType Junction -Name $file.name -Target $file | |
} else | |
{ | |
#echo "SymLink : $($file.Name) -> $file" | |
New-Item -ItemType SymbolicLink -Name $file.name -Target $file | |
} | |
} | |
} | |
pause |
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
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas] | |
@="Paste Symlink" | |
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command] | |
@="powershell.exe -File \"C:\\CMD\\paste-symlink.ps1\" -location \"%V\"" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh, how do i actually use these though? Where do i put them? How do i apply the reg edits?