Re: Copy shortcut to desktop in a batch file



The date and time was 7/21/2008 11:40 AM, and on a whim, Pegasus (MVP) pounded out on the keyboard:

Instead of writing

copy XXX.lnk "%allusersprofile\desktop", try this:
copy /y XXX.lnk "%allusersprofile%\desktop"

You'll notice the missing "%". The "/y" switch will ensure
that there will be no prompt in case the file already exists.

Furthermore, to make your batch file robust, add the full path
to your source file, e.g. like so:

xcopy /y /d "U:\Some Folder\XXX.lnk" "%allusersprofile%\desktop"

Using xcopy.exe with the /d switch will prevent mindless
copying of the same file each time the use command is
invoked.



"Diane Walker" <ett9300@xxxxxxxxx> wrote in message news:%23djR3r16IHA.4292@xxxxxxxxxxxxxxxxxxxxxxx
Thank you very much all for your prompt response.

The batch file is
copy XXX.lnk "%allusersprofile\desktop"

The error message said "file not found". I interpret that the batch file cannot find "XXX.lnk" file even though the shortcut "XXX.lnk" does exist. Please let me know if you need additional information. Thanks.

"Pegasus (MVP)" <I.can@xxxxxxxxxx> wrote in message news:%23%23XQke16IHA.1460@xxxxxxxxxxxxxxxxxxxxxxx
"Diane Walker" <ett9300@xxxxxxxxx> wrote in message news:OLwC$w06IHA.1196@xxxxxxxxxxxxxxxxxxxxxxx
I use Installshield software to setup the executable file to install the software. In that executable file, I setup a batch file to copy a shortcut to the desktop. The executable file ran successfully. However, the shortcut was not copied to the desktop. I got the error message "File not found" for the shortcut command. Do you have any suggestions? Thanks.
Let's have a look at your batch file!





Sorry Pegasus, I didn't see that you also suggested adding the path to the source when I replied to Diane.

--
Terry R.

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
.



Relevant Pages

  • Re: Copy shortcut to desktop in a batch file
    ... Thank you very much for your prompt response and suggestions. ... Furthermore, to make your batch file robust, add the full path ... The error message said "file not found". ... the shortcut was not copied to the desktop. ...
    (microsoft.public.windowsxp.general)
  • Re: Copy MS Access shortcut to desktop with a batch file
    ... Pegasus (MVP) wrote: ... I have a batch file that copies files from our server onto all users ... Create one such shortcut, ...
    (microsoft.public.windowsxp.general)
  • Re: Copy shortcut to desktop in a batch file
    ... Furthermore, to make your batch file robust, add the full path ... The error message said "file not found". ... The executable file ran successfully. ... the shortcut was not copied to the desktop. ...
    (microsoft.public.windowsxp.general)
  • Re: Copy shortcut to desktop in a batch file
    ... "Pegasus " wrote in message ... Furthermore, to make your batch file robust, add the full path ... The error message said "file not found". ... I interpret that the batch file cannot find "XXX.lnk" file even though the shortcut "XXX.lnk" does exist. ...
    (microsoft.public.windowsxp.general)
  • Re: Copy shortcut to desktop in a batch file
    ... The error message said "file not found". ... I interpret that the batch file ... The executable file ran successfully. ... the shortcut was not copied to the desktop. ...
    (microsoft.public.windowsxp.general)