AllExperts > VB Script 
Search      
VB Script
Volunteer
Answers to thousands of questions
 Home · More VB Script Questions · Answer Library  · Encyclopedia ·
More VB Script Answers
Question Library

Ask a question about VB Script
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Subbu
Expertise
I can answer VB Script questions which are related to Visual Basic / VBA / QTP Scripts.

Experience
8 Years

Education/Credentials
Master of Computer Applications

Awards and Honors
Established Member from QA Forums and Brainbench certification

 
   

You are here:  Experts > Computing/Technology > Basic > VB Script > internet shortcut in program subfolder.

VB Script - internet shortcut in program subfolder.


Expert: Subbu - 4/17/2009

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.

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.