Question QUESTION: Thanks for helping out. I am able to create an internet shortcut to the desktop via available vbscript but haven't been able to figure out how to create this in a program files subfolder. Here's the code I am using to create one on the desktop. Thanks again for your help. Alan
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Setup.url")
oUrlLink.TargetPath = "http://www.clnmnd.com"
oUrlLink.Save
ANSWER: Hi Alan,
can you email me value of strDesktop variable has.
If it is this
C:\windows\desktop
then use this code
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oUrlLink = WshShell.CreateShortcut(mid(strdesktop,1,instr(1,strdesktop,"\"))&"Program Files" & "\Setup.url")
oUrlLink.TargetPath = "http://www.clnmnd.com"
oUrlLink.Save
Let me know if you have any issues.
---------- FOLLOW-UP ----------
QUESTION: Thanks
This is going to be part of nested build that will be used on vista and xp so there are different paths to the desktop. I ended up with this work around that copies the shortcut to the program subfolder. However, I get an error message when the shortcut already exists. Is there another way to write this besides 'on error resume next' to avoid the error. Thanks your help and time are very much appreciated.
on error resume next
If not filesys.FileExists("c:\program files\myinstallfolder\tutorial\tutorial.html") Then
First find out what is the error number you are getting(Here i am assuming 1234).
Private Sub CopyShortCut()
on error goto err_CopyShortCut
' your code here
' your code here
' your code here
exit_CopyShortCut:
exit Sub
err_CopyShortCut:
if err.Number = 1234 'Shortcut already exists
goto exit_CopyShortCut 'Ignore this error
else
msgbox err.Description
goto exit_CopyShortCut
end if
End Sub