Esta função do PowerShell faria o truque.
Salve-o em qualquer lugar como Create-ShortcutForEachFile.ps1
carregue-o em uma sessão do PowerShell assim: . C:\somewhere\Create-ShortcutForEachFile.ps1
Em seguida, use-o da seguinte forma: Create-ShortcutForEachFile -Source C:\foo -Destination C:\bar -Recurse
function Create-ShortcutForEachFile {
Param(
[ValidateNotNullOrEmpty()][string]$Source,
[ValidateNotNullOrEmpty()][string]$Destination,
[switch]$Recurse
)
# set recurse if present
if ($Recurse.IsPresent) { $splat = @{ Recurse = $true } }
# Getting all the source files and source folder
$gci = gci $Source @splat
$Files = $gci | ? { !$_.PSisContainer }
$Folders = $gci | ? { $_.PsisContainer }
# Creating all the folders
if (!(Test-Path $Destination)) { mkdir $Destination -ea SilentlyContinue > $null }
$Folders | % {
$Target = $_.FullName -replace [regex]::escape($Source), $Destination
mkdir $Target -ea SilentlyContinue > $null
}
# Creating Wscript object
$WshShell = New-Object -comObject WScript.Shell
# Creating all the Links
$Files | % {
$InkName = "{0}.lnk" -f $_.BaseName
$Target = ($_.DirectoryName -replace [regex]::escape($Source), $Destination) + "\" + $InkName
$Shortcut = $WshShell.CreateShortcut($Target)
$Shortcut.TargetPath = $_.FullName
$Shortcut.Save()
}
}