Re: Copy shortcut to desktop in a batch file



The date and time was 7/21/2008 5:00 PM, and on a whim, Diane Walker pounded out on the keyboard:

Thank you very much for your prompt response and suggestions. I still got the same error message.

"Pegasus (MVP)" <I.can@xxxxxxxxxx> wrote in message news:OBy1RF26IHA.1080@xxxxxxxxxxxxxxxxxxxxxxx
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!






Hi Diane,

Combining the suggestions of Bill and Pegasus should resolve your issue. You need to include the full path of XXX.lnk as I doubt the batch file is in the same folder as the LNK file.

--
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: Copying files using process class in ASP.NET
    ... If the problem is permissions, ... displaying an error message in the output stream. ... The batch file is using robocopy to copy over the files. ...
    (microsoft.public.dotnet.languages.csharp)
  • 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 shortcut to desktop in a batch file
    ... The date and time was 7/21/2008 11:40 AM, and on a whim, Pegasus pounded out on the keyboard: ... Furthermore, to make your batch file robust, add the full path ... I interpret that the batch file cannot find "XXX.lnk" file even though the shortcut "XXX.lnk" does exist. ... I got the error message "File not found" for the shortcut command. ...
    (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: Make an automatic task?
    ... Try this from a command prompt first: ... If that doesn't work and results in an error message, ... I wrote the batch file - named the icon do it.bat ... I thought that after clicking on the icon, ...
    (microsoft.public.windowsxp.customize)

Loading