Created
June 1, 2013 13:25
-
-
Save someshinyobject/5690364 to your computer and use it in GitHub Desktop.
Iterates through a given folder's ChildItems and creates a symbolic link in a different given directory.
This file contains hidden or 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
$toLink = 'C:\Program Files'; | |
$toWhere = 'D:\Program Files'; | |
$items = Get-ChildItem -path $toLink; | |
foreach ($line in $items) { | |
if ($line -eq $null) {break;} | |
$exp = 'cmd /c mklink /d "' + $toWhere + '\' + $line + '" "' + $toWhere + '\' + $line + '"'; | |
Write-Host $exp; | |
Invoke-Expression -Command $exp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment