PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Copy shortcut to desktop in a batch file

 
 
Diane Walker
Guest
Posts: n/a
 
      21st Jul 2008
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.


 
Reply With Quote
 
 
 
 
AlmostBob
Guest
Posts: n/a
 
      21st Jul 2008
batch files cant contain spaces in file names, so
copy \program files\thisfile.ext \anydestination
fails
copy "\program files\thisfile.ext" "\anydestination in quotes around spaces"
proceeds

the copy may fail if you specify a desktop foldername, that does not exist
this pc has none of
C:\documents and settings\all users\desktop
C:\documents and settings\all users
C:\documents and settings
C:\documents and settings\user\desktop
C:\documents and settings\user

but %Homedrive%%Homepath%\desktop
works as does
%Homedrive%%allusersprofile%\desktop
windowsXP is on a virtual drive P: running as a toy in the background

batch files are unfriendly and expect you to code for all possibilities,

--
Adaware http://www.lavasoft.de
spybot http://www.safer-networking.org
AVG free antivirus http://www.grisoft.com
Etrust/Vet/CA.online Antivirus scan
http://www3.ca.com/securityadvisor/virusinfo/scan.aspx
Panda online AntiVirus scan http://www.pandasoftware.com/ActiveScan/
Catalog of removal tools (1)
http://www.pandasoftware.com/download/utilities/
Catalog of removal tools (2)
http://www3.ca.com/securityadvisor/n...aspx?CID=40387
Blocking Unwanted Parasites with a Hosts file
http://mvps.org/winhelp2002/hosts.htm
links provided as a courtesy, read all instructions on the pages before use

Grateful thanks to the authors and webmasters
_

"Diane Walker" <(E-Mail Removed)> wrote in message
news:OLwC$(E-Mail Removed)...
>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.
>



 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      21st Jul 2008
Your reply is basically correct but a little confusing - see below.

"AlmostBob" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> batch files cant contain spaces in file names, so

*** Yes, they can.

> copy \program files\thisfile.ext \anydestination fails
> copy "\program files\thisfile.ext" "\anydestination in quotes around
> spaces"
> proceeds

*** This is because folder/file names that have embedded spaces
*** must be surrounded by double quotes. This is a requirement
*** of console commands and has nothing to do with batch files.

> the copy may fail if you specify a desktop foldername, that does not exist
> this pc has none of
> C:\documents and settings\all users\desktop
> C:\documents and settings\all users
> C:\documents and settings
> C:\documents and settings\user\desktop
> C:\documents and settings\user

*** All of the above must be surrounded by double quotes.

> but %Homedrive%%Homepath%\desktop
> works as does
> %Homedrive%%allusersprofile%\desktop

*** No, they do not, because %HomePath% and %AllUsersProfile%
*** have embedded spaces. They must be surrounded by double quotes.

> windowsXP is on a virtual drive P: running as a toy in the background

*** Meaning?

> batch files are unfriendly and expect you to code for all possibilities,

*** Batch files, same as console commands, require precise coding.
*** They have no safety net, as opposed to GUIs.

> "Diane Walker" <(E-Mail Removed)> wrote in message
> news:OLwC$(E-Mail Removed)...
>>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.
>>

>
>



 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      21st Jul 2008

"Diane Walker" <(E-Mail Removed)> wrote in message
news:OLwC$(E-Mail Removed)...
>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!


 
Reply With Quote
 
Diane Walker
Guest
Posts: n/a
 
      21st Jul 2008
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)" <(E-Mail Removed)> wrote in message
news:%23%(E-Mail Removed)...
>
> "Diane Walker" <(E-Mail Removed)> wrote in message
> news:OLwC$(E-Mail Removed)...
>>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!
>



 
Reply With Quote
 
Bill Sharpe
Guest
Posts: n/a
 
      21st Jul 2008
Diane Walker wrote:
> Thank you very much all for your prompt response.
>
> The batch file is
> copy XXX.lnk "%allusersprofile\desktop"
>

Add the full path to XXX.lnk,
e.g. copy "C:\My Install Directory\XXX.lnk"

Bill
 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      21st Jul 2008
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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)" <(E-Mail Removed)> wrote in message
> news:%23%(E-Mail Removed)...
>>
>> "Diane Walker" <(E-Mail Removed)> wrote in message
>> news:OLwC$(E-Mail Removed)...
>>>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!
>>

>
>



 
Reply With Quote
 
Diane Walker
Guest
Posts: n/a
 
      22nd Jul 2008
Thank you very much for your prompt response and suggestions. I still got
the same error message.

"Pegasus (MVP)" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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)" <(E-Mail Removed)> wrote in message
>> news:%23%(E-Mail Removed)...
>>>
>>> "Diane Walker" <(E-Mail Removed)> wrote in message
>>> news:OLwC$(E-Mail Removed)...
>>>>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!
>>>

>>
>>

>
>



 
Reply With Quote
 
Terry R.
Guest
Posts: n/a
 
      22nd Jul 2008
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)" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> 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)" <(E-Mail Removed)> wrote in message
>>> news:%23%(E-Mail Removed)...
>>>> "Diane Walker" <(E-Mail Removed)> wrote in message
>>>> news:OLwC$(E-Mail Removed)...
>>>>> 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.
 
Reply With Quote
 
Terry R.
Guest
Posts: n/a
 
      22nd Jul 2008
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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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)" <(E-Mail Removed)> wrote in message
>> news:%23%(E-Mail Removed)...
>>> "Diane Walker" <(E-Mail Removed)> wrote in message
>>> news:OLwC$(E-Mail Removed)...
>>>> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you copy a shortcut to a file with a batch file? Pegasus \(MVP\) Windows XP General 11 13th Apr 2007 10:56 PM
Copy MS Access shortcut to desktop with a batch file Lee Windows XP General 7 14th Nov 2006 01:17 PM
Batch file to copy a file on Desktop Irshad Alam Windows XP General 2 5th Sep 2004 05:03 PM
Create a batch file to place a shortcut on a desktop =?Utf-8?B?Q29ubmllTg==?= Windows XP General 1 7th May 2004 02:52 AM
FAQ - creating desktop shortcut from batch file - without shortcut.exe Tom Lavedas Windows XP General 0 9th Sep 2003 06:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:53 PM.