Jump to content

Copy Files That Shortcut links Point To..?


Recommended Posts

Is there any way for AutoIt to read a shortcut.lnk file and then copy the file its pointing to, into another directory..??

say like DOC123.lnk exists in folder "C:\Documents and Settings\%username%\Recent\" and it points to "C:\Documents and Settings\%username%\Desktop\DOC123.RTF"

is there anyway to read that shortcut.lnk file then copy the file it points to, into another directory, then delete that shortcut.lnk file..??

Link to comment
Share on other sites

$ShortcutPath = 'Path of your shortcut'
$PathTo = FileGetShortcut($ShortcutPath)
$Destination = @DesktopDir; replace this with your destination

If Not @error = 1 Then
    FileCopy($PathTo[0], $Destination)
    FileDelete($ShortcutPath)
Else
    MsgBox(0, '', 'invalid shortcut')
EndIf

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...