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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating shortcuts

Status
Not open for further replies.

Tranbjerg

IS-IT--Management
Jul 31, 2003
8
DK
Hi

I need to create shortcuts that is pointing on a speciel .ini file, but I can't create it with the right destination. The destination should be:

c:\notes\notes.exe "=c:\documents and settings\jek\application data\notes\notes.ini"

Instead it creates this destination that doesn't work:
"c:\notes\notes.exe" "=c:\documents and settings\jek\application data\notes\notes.ini"

The code:
Dim struser

Set WshShell = CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")

struser= WshNetwork.username
strDesktopPath = WshShell.SpecialFolders("Desktop")
StrStartMenu = WshShell.SpecialFolders("StartMenu")

Set objDeskShortcutLnk = WshShell.CreateShortcut(strDesktopPath & "\ Lotus Notes.lnk")
objDeskShortcutLnk.TargetPath = "c:\Notes\notes.exe"" ""=C:\Documents and Settings\" & struser & "\Application Data\Notes\notes.ini"
objDeskShortCutLnk.WorkingDirectory = "C:\Notes\"
objDeskShortCutLnk.IconLocation = "c:\Notes\notes.exe, 0"
objDeskShortcutLnk.Save

Set objStartShortcutLnk = WshShell.CreateShortcut(strStartMenu & "\Lotus Notes.lnk")
objStartShortcutLnk.TargetPath = "c:\Notes\notes.exe"" ""=C:\Documents and Settings\" & struser & "\Application Data\Notes\notes.ini"
objStartShortCutLnk.WorkingDirectory = "C:\Notes\"
objStartShortCutLnk.IconLocation = "c:\Notes\notes.exe, 0"
objStartShortcutLnk.Save
 
Use the Arguments property of the WshShortCut Object.
The TargetPath property must be set to the pathname, without argument.

Hope This Help
PH.
 
Hi

I'm nearly there. I just need that the destination has "" at the argument.

The code
Set objShtCut = objShell.CreateShortcut(strDesktopPath & "\ Lotus Notes.lnk")
objShtCut.TargetPath = "c:\Notes\notes.exe"
objShtCut.Arguments = objShtCut.Arguments & "=C:\Documents and Settings\" & struser & "\Application Data\Notes\notes.ini"
objShtCut.WorkingDirectory = "C:\Notes\"
objShtCut.IconLocation = "c:\Notes\notes.exe, 0"
objShtCut.Save

The result
C:\Notes\notes.exe =C:\Documents and Settings\jek\Application Data\Notes\notes.ini

It should be
C:\Notes\notes.exe "=C:\Documents and Settings\jek\Application Data\Notes\notes.ini"

I have tried to but extra "" on the argument setting, but that results in a VBScript error

Regards
Jens
 
Add the quotes:
Code:
objShtCut.Arguments = objShtCut.Arguments & """=C:\Documents and Settings\" & struser & "\Application Data\Notes\notes.ini"""
 
Hi

It's working :)

I just had to add the extra quotes.

Thanks
Jens
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top