gist

11 Articles

Report Shortcut Properties

When working with a folder that contains several shortcuts, it can be tedious to check the properties of each shortcut. This PowerShell script loops over all of the shortcuts in the folder and reports the name of the executable, start in path, and command line arguments in table format.

$path = Read-Host "Enter the path to search for shortcuts"; Get-ChildItem $path -Filter *.lnk | Select-Object @{Name='Shortcut';Expression={$.Name}}, @{Name='Target';Expression={(New-Object -ComObject WScript.Shell).CreateShortcut($.FullName).TargetPath}}, @{Name='Arguments';Expression={(New-Object -ComObject WScript.Shell).CreateShortcut($.FullName).Arguments}}, @{Name='StartIn';Expression={(New-Object -ComObject WScript.Shell).CreateShortcut($.FullName).WorkingDirectory}} | Format-Table -AutoSize