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!

Create shortcut in Windows 2008 (x86)

Status
Not open for further replies.

DotNetNewbie

Programmer
Mar 3, 2004
344
GB
Hi there,

I am wanting to adapt my old login script to create shortcuts but I am getting the "cannot use parentheses" message, any advice most welcome:

CreateSMIcon("Google Chrome", "Google Chrome", "C:\Program Files (x86)\Google\Chrome\Application", "C:\Program Files (x86)\Google\Chrome\Application", "", "C:\Program Files (x86)\Google\Chrome\Application", "")

And the sub is below:

Private Sub CreateSMIcon(strDestination, strName, strPath, strWorkDir, strArguments, strIconLocation, strWindowStyle)
'Msgbox "Creating Icon for " & strName
Dim oWshShell, oFSO, oStartMenu, oIcon
Set oWshShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
If strIconLocation = " " then
strIconLocation = strPath
End If
If oFSO.FileExists(strpath) Then
oStartMenu = WshShell.SpecialFolders("All Programs")
Set oIcon = WshShell.CreateShortcut(oStartMenu & "\" & strDestination & "\" & strName & ".lnk")
oIcon.WindowStyle = strWindowStyle
oIcon.TargetPath = strPath
' oIcon.IconLocation = strPath
oIcon.IconLocation = strIconLocation
oIcon.Arguments = strArguments
oIcon.Description = "Created by Login script"
oIcon.WorkingDirectory = strWorkDir
oIcon.Save
End If
End Sub

Many thanks in advance.

.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top