DotNetNewbie
Programmer
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
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