Skip to content

Instantly share code, notes, and snippets.

@someshinyobject
Created June 1, 2013 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save someshinyobject/5690364 to your computer and use it in GitHub Desktop.
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.
$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