8

I have a folder containing shortcuts that point to files that are located in various directories and drives. I would like to copy the files pointed to (NOT the shortcut files themselves) to a single destination folder.

Is there a way in windows (XP, Vista, 7), file manager, or some utility I can use to do this?

I've heard you can do this with various multi-step custom scripts. However, I've heard rumors there is a one click way to do this without having to fabricate a custom script each time, where regardless where the shortcuts point to, I can select the group of shortcuts and do a copy operation that will grab the files they point to. Then, I can paste or otherwise put the actual files (not shortcuts) into one directory.

It would be very time consuming to manually find each file pointed to by a shortcut and one by one copy them to the target folder.

Note that I've seen this question asked before on the internet but haven't seen a good answer.

1
  • use copylinktarget plugin for total commander. – user111518 Dec 30 '11 at 11:15

11 Answers 11

4

I think the answer is no because a shortcut is not really a symbolic link in the same way it is in linux. The concept of symbolic link was introduced as part of NTFS 5.0, but they apply to directories, not files. Things may have changed in windows 7, I admit to being clueless there. Shell-shocked has a good article on Windows Symbolic and Hard Links.

It would be cool to be proven wrong on this one, because this is a problem I would love to have a solution to at work!

1
  • Windows .lnk files are similar to Linux .desktop files, aren't they? – petersohn Apr 16 '10 at 6:50
4

I've found a very easy method of copying the files shortcuts are pointing to rather than the shortcuts themselves:
Add the selection of shortcuts to ZIP (via the shell extension). Then the original files automatically get zipped and not the shortcuts.
Extracting the content of the ZIP file into a location of your preference gets the job done perfectly and quickly.

2
  • 1
    Doesn't work for me on Windows 8, at least with the OS built-in way of making ZIP files: right-click > Send To > "Compressed (zipped) folder". – peterflynn Sep 14 '17 at 18:34
  • This works if the links are created using "mklink /J". – Albion Mar 10 '18 at 14:36
2

You can also use the filemanager Total Commander and the plugin CopyLinkTarget to copy the link targets very easily.

1

As an alternative workaround, I found Microsoft Groove very helpful. Files can be dropped into a Groove workspace as a temporary placeholder (like a zip file). Then drag and drop the files from the Groove workspace onto the destination folder in Windows Explorer.

1

I had a similar problem where by we had a tree structure of shortcuts. We wanted to copy the target files along side the shortcut.

Below is the VB Script. You can easily change the destination directory by changing the fp_des variable.

Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("Wscript.Shell")

function main()

    if Wscript.Arguments.Count = 0 then Wscript.Echo "Please pass path to folder to scan"

    Wscript.Echo "Getting list of all files..."
    set all_files = get_files(Wscript.Arguments(0),"lnk",Nothing)

    for each fp_sc in all_files.Items
        Set sc = shell.CreateShortcut(fp_sc)        

        fp_src = sc.TargetPath
        fp_des = fso.GetParentFolderName(fp_sc) & "\" & fso.GetFileName(fp_src)

        if not fso.FileExists(fp_src) then
            Wscript "ERROR: Failed to find: " & vbcrlf & fp_src
        elseif fso.FileExists(fp_des) then
            Wscript.Echo "Already exists: " & fso.GetFileName(fp_des)
        else
            Wscript.Echo "Copying: " & fso.GetFileName(fp_des)

            fso.CopyFile fp_src,fp_des
        end if
    next

end function

function get_files(fp_dir,ext,dic) 
    if dic is Nothing then set dic = CreateObject("Scripting.Dictionary")

    set fldr = fso.GetFolder(fp_dir)

    for each fl in fldr.Files
        if fso.GetExtensionName(fl) = ext OR ext = "" then
            dic.Add dic.Count, fl   
        end if
    next

    for each fl_child in fldr.SubFolders
        get_files fl_child,ext,dic
    next

    set get_files = dic
end function

main

Run using the following code

cscript.exe //nologo links_to_files.vbs "%path_to_root_dir%"
1
  • Worked great - thanks very much! I ran it with . as the path, in the directory with the lnks, and it worked just fine. The FileExists(fp_des) check is a nice touch. – cxw Dec 17 '17 at 22:17
0

It's straightforward in PowerShell.

To copy the target of a Windows shortcut (*.lnk) using PowerShell

(modified from http://windowsitpro.com/powershell/working-shortcuts-windows-powershell)

1) Create the following file (Powershell script):

====== file Get-Shortcut.ps1============

begin

{
    $WshShell = New-Object -ComObject WScript.Shell;
}

process

{
    $WshShell.CreateShortcut($_)
}
====== end file Get-Shortcut.ps1============

2) set execution policy to run scripts

Various ways to do this. One method:

  • Run powershell as administrator

  • Set-ExecutionPolicy bypass

(when done, set it back, e.g. "Set-ExecutionPolicy Default")


3) Run this loop in PowerShell

foreach ($lnk in Get-ChildItem C:\FromDir\\*.lnk -ErrorAction SilentlyContinue | .\Get-Shortcut.ps1)

{

echo $lnk.targetpath 

copy $lnk.targetpath C:\ToDir

}
0

Hold down the [Ctrl] key. Click and drag what you want to copy.

1
  • 1
    This does not do what the original question asked for. – Heptite Aug 3 '14 at 19:31
0

Other possibility: there is the utility ShortcutsToClipboard.exe:

  1. Copy the utility into the folder that has the shortcuts.
  2. Run it. This will copy the shortcuts' targets into the clipboard.
  3. Navigate with Explorer to the target directory and press Ctrl-V or "Rightclick > Insert".
  4. Copying is executed

(Original source of information)

0

In my previous reply. I mentioned that back in the 1990's, Aladdin made a PC version of Dropstuff which made both "zip" and "sit" compressed archives. Believe it or not, I still have a Windows 98 computer that has version 5.0 of Aladdin Dropstuff installed on it. Like the ancient Mac version, this PC version allows you to select as a preference, whether the link it was given should be put into the archive or the original file that the link points to. Unfortunately, there are some issues. First, one of keyboard short-cuts for this program is ctrl+z which might interfere with what ctrl+z is supposed to do in other programs. Second, if you install this on a Windows 7 computer, it is not clear how well it will co-exist with the compressed "zip" file handling that is now built in to Windows (Windows 95 and 98 did not have this capability). In any case, once the files you want are in the "zip" archive that Aladdin Dropstuff will make, it is a simple matter to get those files from that archive.

-1

I know you said Windows XP, Vista or 7, but back in the 1990's in Mac OS 7, you could tell Aladdin's DropStuff software (by checking a box in the preferences) to Stuff the Original files instead of the Aliases (shortcuts) when creating a "sit" (similar to a "zip") compressed archive. Back in those days, there was a free PC version of Aladdin's software that made "zip" archives. It ran on Windows 95 and 98. Perhaps it will run on Windows XP, Vista or 7 and allow you to do the same thing there.

-1

Download XYplorer for Windows.
Right click on shortcuts and select

Shortcut target -> Copy shortcut item target

and enjoy ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.