2

(Windows10) Sometimes I need to create a subset of a master photos folder, but I am trying to be cute and save space by creating the SUBSETFOLDER somewhere, then selecting the pictures I want, right-clicking one of the files and dragging this subset to SUBSETFOLDER. When I release the mouse button, I choose to "create shortcuts" which in effect creates shortcuts to all the selected files.
That works as intended, I can then goto SUBSETFOLDER, click on one of the shortcuts and the picture appears. I can even right-arrow and peruse the other pictures without issues.

Presuming I now wanted to send the actual files to a photo-printing company or put them on a USB stick, is there a script/utility/trick to convert these shortcuts to the actual pictures so I can copy them to the USB stick? (Apologies if that has been resolved before, I saw a similar thread but it seemed overly-complicated for doing something similar it looked like.)

1 Answer 1

0

This can be accomplished in PowerShell using the wscript.shell COM object, which, among other things, contains methods for reading, creating, and modifiying .lnk files.

This is "bare-bones" with no verifiction of paths or error trapping, focusing on the logic. If this is a frequent operation, this code could for the basis for a reusable function.

$SubsetFolder  = 'C:\<Path to folder containing .lnk shortcut files>'
$Destination   = '<Path to copy destination>'

$WshShell      = New-Object -com wscript.shell

Get-ChildItem $SubsetFolder *.lnk |
    ForEach-Object {
        ( $WshShell.CreateShortcut( $_.FullName )).TargetPath |
            Copy-Item -Destination $Destination -WhatIf
    }

ForEach-Object processes each file in $SubsetFolder.

Note that Copy-Item is using the -WhatIf parameter. This allows you to preview the copy action without actually copying the files --- useful for verifying only desired files are being processed. Delete the parameter to acutually copy the files.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .