本帖最后由 zhangop9 于 2011-9-9 23:01 编辑
“用VBS按需批量创建快捷方式”在网上找到的运行错误,求高手改一下方便系统重装时恢复快捷方式。- "F:\GreenTools\系统工具\CloseMonitor.scr'
- "#F:\GreenTools\TextTools\UltraEdit16\Uedit32.exe
- "F:\GreenTools\VirtualTools\VMware7\vmware.exe"
- "F:\GreenTools\Devtools\MyEclipse8\MyEclipse 8.x Latest\myeclipse.exe"
- "F:\GreenTools\网络工具\comunication\QQ2010\Bin\QQ.exe"
- "F:\GreenTools\网络工具\FlashXP3.6\flashfxp.exe"
- "F:\GreenTools\通讯\G3 eWalk\G3 eWalk.exe"
- "F:\GreenTools\Devtools\VC++6\Common\MSDev98\Bin\MSDEV.EXE"
- "===================================================
- 'Option Explicit
- Const ForReading = 1
- Const isCrerateShortcut=1
- "参数说明:1创建快捷方式;0删除快捷方式
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- Set objTextFile = objFSO.OpenTextFile("添加常用应用程序到桌面图标.vbs", ForReading)
- Do Until objTextFile.AtEndOfStream
- Dim strNextLine
- Dim spIndex,program,path,pname,ShortcutName
- Dim WshShell
- set WshShell = WScript.CreateObject("WScript.Shell")
- "
- strNextLine = objTextFile.Readline
- strNextLine = Mid(strNextLine,2,Len(strNextLine))
- If(InStr(strNextLine,"=====")<>0) Then
- Exit Do
- End If
- spIndex=InStr(strNextLine,"#")
- If (spIndex=0) Then
- part=split(strNextLine,"\")
- program=strNextLine
- pname=part(UBound(part))
- path=Mid(strNextLine,1,InStr(strNextLine,pname)-1)
- ShortcutName=Mid(pname,1,InStr(pname,".")-1)
- "MsgBox ShortcutName
- "下面是创建或删除快捷方式
- strDesktop = WshShell.SpecialFolders("Desktop")
- If(isCrerateShortcut=1)Then "创建
- set oShellLink = WshShell.CreateShortcut(strDesktop & "\" & ShortcutName & ".lnk") "快捷方式的名字
- oShellLink.TargetPath = program "快捷方式里的“目标”
- oShellLink.WindowStyle = 1 "快捷方式里的“运行方式”:参数1默认窗口激活,参数3最大化激活,参数7最小化
- oShellLink.WorkingDirectory =path "快捷方式里的“起始位置”
- oShellLink.Description = "该快捷方式由VBS添加" "快捷方式里的“备注”
- oShellLink.Save
- ElseIf(isCrerateShortcut=0)Then "删除
- objFSO.DeleteFile strDesktop & "\" & ShortcutName & ".lnk"
- End If
- End If
- Loop
- objTextFile.Close
复制代码
|