脚本 · 2012年2月11日

VBS创建桌面快捷方式

近段时间学习VBS,配合教程作了一个小脚本.留作记号

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Wscript.Shell")
If rtnVal = vbYES Then
	sDesktop = oShell.SpecialFolders("Desktop")
	set oShellLink1 = oShell.CreateShortcut(sDesktop & "\HtaEdit.lnk")
	oShellLink1.TargetPath = Chr(34)& sCurDir & "\Htaedit.exe" & Chr(34)
	oShellLink1.WorkingDirectory = Chr(34)& sCurDir & Chr(34)
	oShellLink1.Save
	set oShellLink2 = oShell.CreateShortcut(sDesktop & "\VbsEdit.lnk")
	oShellLink2.TargetPath = Chr(34)& sCurDir & "\Vbsedit.exe" & Chr(34)
	oShellLink2.WorkingDirectory = Chr(34) & sCurDir & Chr(34)
	oShellLink2.Save
End If

如果有错误,请大侠们指点.