Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a Shortcut error

Status
Not open for further replies.

Christine123

Programmer
Joined
Jun 14, 2005
Messages
7
Location
CA
I posted a question about paths with spaces a few days ago. I got a reply to use more quotes which I did. Now I'm getting a new error. This is what I have now:

Call Shortcut("""C:\DOCUMENTS AND SETTINGS\ALL USERS\DOCUMENTS\FP_DEVEL\Links\meet.lnk""","""C:\Documents and Settings\All Users\Documents\fp_devel\meet.csv""")
Sub Shortcut(LinkFile, CommandLine)
Set WshShell=WScript.CreateObject("WScript.Shell")
Set ShortcutHandle = WshShell.CreateShortcut (LinkFile)
ShortcutHandle.TargetPath = CommandLine
ShortcutHandle.Save
End Sub

I used to have one set of quotes around the paths. Now if I double click on the VBS file (this used to work) I get the error: The shortcut pathname must end with .lnk or .url.

If I try to run this from a BAT file (which is what I need to do), I get the same error I got before: Windows cannot find 'C:\Documents'.

Any other way around this?
 
And this ?
Call Shortcut("C:\DOCUMENTS AND SETTINGS\ALL USERS\DOCUMENTS\FP_DEVEL\Links\meet.lnk", """C:\Documents and Settings\All Users\Documents\fp_devel\meet.csv""")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV

I got double clicking on the VBS file to work. Running it from a bat file still gives me the same message. After a bit of fooling around with it I discovered that it is the second path (parameter) that is causing the problem. It doesn't seem to recognize the extra quotations. Unfortunatly the second path is the one I have no control over. Any other ideas?
 
I have figured it out. The problem was with the BAT file not the VBS file. Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top