Jump to content

FileCopy and Shortcut files


Recommended Posts

When using FileCopy, I've noticed that shorcuts (*.LNK) files don't copy.

I'm trying to copy shortcuts from C:\SOME_DIR to C:\Documents and Settings\All Users\Desktop\

Here's a code snippet:

CODE
FileCopy ("C:\Scripts\WordEULA.lnk", "C:\Documents and Settings\All Users\Desktop\", 9)

The question is: Are shortcut files (*.LNK) so odd that FileCopy () can't handle them?

Link to comment
Share on other sites

Are you sure WordEULA.lnk is a shortcut? FileCopy copies shortcut files fine for me. If you can see the .lnk file extension, something is wrong because even with my settings(the OS shows all filetypes, hidden files, and system files), I can't see the .lnk extension. If you can see the .lnk extension and your file is actually a shortcut, this leads me to believe that your file is actually named "WordEULA.lnk.lnk".

Try this to see if it works if that is the case:

FileCopy ("C:\Scripts\WordEULA.lnk.lnk", "C:\Documents and Settings\All Users\Desktop\", 9)

EDIT: Didn't see your post explaining that you used dir to get the file listings in the directory. Dir does show the correct extension, making the above mistake less likely.

- The Kandie Man ;-)

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

See if this works, just for kicks:

FileCopy ("C:\Scripts\WordEULA.lnk", "C:\Documents and Settings\All Users\Desktop\WordEULA.lnk", 9)

Also, what version of windows are you using?

- The Kandie Man ;-)

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

What I really hate is typos. Instead of "C:\Scripts\etc" the code should read "C:\Script\etc".

(Banging head on desk, using NSFW language under breath, etc)

Thanks for your patience..... Ò¿Ö

It happens to the best of us. Glad you got the problem resolved.

- The Kandie Man ;-)

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

I just did this;

FileCopy("C:\Documents and Settings\some_user\Desktop\Paint.lnk", "C:\Documents and Settings\some_user\Desktop\Temp\", 9)

And it works. Just to show you that FileCopy() can handle *.lnk files.

What I'm thinking is that, either your source doesn't exist or your destination.

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Link to comment
Share on other sites

  • 4 years later...
  • Moderators

atadams77,

This thread is over 4 years old - please do not necro-post again. :oops:

We do not encourage it because AutoIt has changed enormously since then and it is very unlikely the problem and/or code are still relevant today. :bye:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...