WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: jfrasier on June 22, 2015, 01:26:59 PM

Title: Copy desktop shortcut
Post by: jfrasier on June 22, 2015, 01:26:59 PM
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.
Title: Re: Copy desktop shortcut
Post by: td on June 22, 2015, 02:05:37 PM
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.
Title: Re: Copy desktop shortcut
Post by: jfrasier on June 24, 2015, 12:49:26 PM
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?
Title: Re: Copy desktop shortcut
Post by: td on June 24, 2015, 08:44:13 PM
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.