Created
November 8, 2023 10:36
-
-
Save eugrus/347dbe683d9d20f339dc30c6e43d4972 to your computer and use it in GitHub Desktop.
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
param( | |
[string]$path = "." | |
) | |
function Get-FolderStructure { | |
param( | |
[string]$folderPath | |
) | |
$folders = Get-ChildItem -Path $folderPath -Directory | |
foreach ($folder in $folders) { | |
Write-Output "Folder: $($folder.FullName)" | |
$files = Get-ChildItem -Path $folder.FullName | |
foreach ($file in $files) { | |
if ($file.Extension -eq ".lnk") { | |
$shortcut = (New-Object -ComObject WScript.Shell).CreateShortcut($file.FullName) | |
$targetPath = $shortcut.TargetPath | |
Write-Output " Shortcut: $($file.Name) -> $($targetPath)" | |
} | |
} | |
Get-FolderStructure -folderPath $folder.FullName | |
} | |
} | |
Get-FolderStructure -folderPath $path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment