Copy desktop shortcut

Started by jfrasier, June 22, 2015, 01:26:59 PM

Previous topic - Next topic

jfrasier

I am trying to copy a desktop shortcut (KronosTrain.lnk) to All Users desktop (Windows 7). I am getting 1009: Filecopy: from file open failed.

Here are my commands.

FileCopy ("C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\2266\KRONOSTraining.lnk", "C:\Users\All Users\desktop\KRONOSTraining.lnk", @true)

I am running the compiled script from a KACE appliance. The KronosTrain.exe and the .KRONOSTraining.lnk  file are zipped and placed in that folder. KACE is supposed to run the .exe after unzipping which didn't happen but I ran the .exe from the folder and got that error.

The shortcut is to a URL which might make a difference.

td

The error's text more less explains the problem so any of the usual reasons for not being able to open a file for reading may be the cause of the error.  Those reasons include but are not limited to insufficient user account privilege to read the file, the file not existing on the specified path, or another running process having exclusive access to the file.
You can use FileExist to check the first and second reason and FileLockItemize to check the third.  The first reason can also be checked using the Network extender.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

jfrasier

Thanks. Still having trouble. I have moved my file to c:\windows\system32

Here is my code
If FileItemize("c:\Windows\System32\kronos.*")==""
   Message("","No files were found")
Else
   Message("","Files were found")
EndIf

It returns 'no files found', yet 2 files exist in that folder beginning with Kronos.

Could it be a permissions thing?

td

If you are referring to the the files in your original post then you file mask is incorrect.  And generally, standard users have listing privileges for the system32 directory on newer versions of Windows.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade