Interactive PowerBasic Forum

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Source Code => Scripting => Windows Script Host => Topic started by: José Roca on July 14, 2008, 06:23:05 AM

Title: IWshURLShortcut.Save Method
Post by: José Roca on July 14, 2008, 06:23:05 AM


The following code illustrates the use of the Save method:


#INCLUDE "WSHOM.INC"

' Create an instance of the Windows Script Host
LOCAL pWsh AS IWshShell
pWsh = NEWCOM "WScript.Shell"

' Create a shortcut programatically (if it already exists, CreateShortcut opens it)
LOCAL pLnk AS IWshURLShortcut
pLnk = pWsh.CreateShortcut(UCODE$(EXE.Path$ & "Microsoft Web Site.url"))

' Sets the TargetPath property
pLnk.TargetPath UCODE$("http://www.microsoft.com")
' Saves the shortcut file to disk
pLnk.Save