Hello everyone
A few days ago I posted a question that jonscott8 answered with exactly what I was trying to do. However to roll something like that to my user community and expect them to create the shortcut correctly might be a stretch. So I wrote a vbscript to create the shortcut for them and place it in the quick launch toolbar. It is working very well execpt with one problem when I pass the target path to the shortcut through the script it passes the double quote marks with the string. When you run the script with the quote marks there window acts like it is looking for a program that it cannot find. If I edit the shortcut and remove the quote marks everything works fine. Does anyone have any ideas on how to not pass the quote marks with the string. Things I have tried set the string as a variable and pass that variable to the command but the quote marks still come I have also put the string in the command as the ref material shows examples but the quote marks still come. Thanks in advance for any help you can give me.
Here is my code:
**********************************************************
Option Explicit
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim objShl
Dim strTargetFolder, strAppDataPath, strQuickLaunchShortCut, strCmd1
strCmd1 = "%windir%\system32\rundll32.exe user32.dll,LockWorkStation"
Set objShl = WScript.CreateObject("WScript.Shell"
strTargetFolder = objShl.SpecialFolders("AppData"
strAppDataPath = strTargetFolder + "\Microsoft\Internet Explorer\Quick Launch\"
Set strQuickLaunchShortCut = objShl.CreateShortcut(strAppDataPath + "ScreenLock.lnk"
strQuickLaunchShortCut.TargetPath = strCmd1
strQuickLaunchShortCut.IconLocation = "%SystemRoot%/system32/shell32.dll,-48"
strQuickLaunchShortCut.Save
***********************************************************
Thanks Randy
A few days ago I posted a question that jonscott8 answered with exactly what I was trying to do. However to roll something like that to my user community and expect them to create the shortcut correctly might be a stretch. So I wrote a vbscript to create the shortcut for them and place it in the quick launch toolbar. It is working very well execpt with one problem when I pass the target path to the shortcut through the script it passes the double quote marks with the string. When you run the script with the quote marks there window acts like it is looking for a program that it cannot find. If I edit the shortcut and remove the quote marks everything works fine. Does anyone have any ideas on how to not pass the quote marks with the string. Things I have tried set the string as a variable and pass that variable to the command but the quote marks still come I have also put the string in the command as the ref material shows examples but the quote marks still come. Thanks in advance for any help you can give me.
Here is my code:
**********************************************************
Option Explicit
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim objShl
Dim strTargetFolder, strAppDataPath, strQuickLaunchShortCut, strCmd1
strCmd1 = "%windir%\system32\rundll32.exe user32.dll,LockWorkStation"
Set objShl = WScript.CreateObject("WScript.Shell"
strTargetFolder = objShl.SpecialFolders("AppData"
strAppDataPath = strTargetFolder + "\Microsoft\Internet Explorer\Quick Launch\"
Set strQuickLaunchShortCut = objShl.CreateShortcut(strAppDataPath + "ScreenLock.lnk"
strQuickLaunchShortCut.TargetPath = strCmd1
strQuickLaunchShortCut.IconLocation = "%SystemRoot%/system32/shell32.dll,-48"
strQuickLaunchShortCut.Save
***********************************************************
Thanks Randy