This code looks alot like the code I have used before.
option explicit
on error resume next
dim shell, desktopPath, link, sys32Path
Set shell = WScript.CreateObject("WScript.shell")
desktopPath = shell.SpecialFolders("Desktop")
sys32Path = "%SystemRoot%\system32"
Set link = shell.CreateShortcut(desktopPath & "\Defrag.lnk")
link.Description = "Defrag"
link.TargetPath = "c:\windows\system32\dfrgui.exe"
link.WindowStyle = 3
link.WorkingDirectory = desktopPath
link.Save
set shell = nothing
if err.number <> 0 then
msgbox "There was an error creating your shortcut." & vbCrLf & err.description & vbCrLf & err.source, vbOKOnly-vbExclamation, "Shortcut Builder"
else
msgBox "Your new shortcut has been created!" & vbCrLf & "Please check your Windows Desktop.", vbOKOnly-vbInformation, "Shortcut Builder"
end if
The only question I have is will this shortcut be on the desktop for each user that logs onto this computer?
I thought SpecialFolders("Desktop") would be SpecialFolders("AllUsersDesktop")
This is where I am getting confused.