- ·上一篇文章:根据IP扫描进程是否存在的VBS脚本,记录扫描结果
- ·下一篇文章:VBS脚本实现进度条的实例(模拟)
- ·百度中搜索更多的关于“批量修改快捷方式路径的VBS脚本”相关内容
- ·谷歌中搜索更多的关于“批量修改快捷方式路径的VBS脚本”相关内容
- ******申明******
- 本站文章内容有部分为收录网络中其他网友内容,DOS资源站不保证所有的代码都适合你使用。
- 由于编辑匆忙,有可能造成某些脚本文件出现丢失代码或代码无法运行的情况,请网友根据情况自行修改。
- 如果能将出错部分反馈给我,那就更好了。
批量修改快捷方式路径的VBS脚本
Option Explicit
Dim oldpath,newpath
oldpath = "x:\game" '设置原路径中将被替换的内容
newpath = "g:\game\langame" '设置新路径中要使用的内容
Dim Wsh,fso
Set Wsh = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Dim ji_1,ji_2,Folder
ji_1 = 0
ji_2 = 0
Folder = Wsh.CurrentDirectory
if Ask("将要修改"&chr(34)& Folder &chr(34)&"里的所有快捷方,是否继续") then
Dim f,fc,f1,ext
Set f = fso.GetFolder(Folder)
Set fc = f.Files
For Each f1 in fc
ext = LCase(fso.GetExtensionName(f1))
if ext = "lnk" then
ji_1 = ji_1 + 1
call Doit(f1)
end if
Next
end if
Set WSH = Nothing
msgbox "找到 "&ji_1&" 个快捷方式"&vbCrLf&"修改 "&ji_2&" 个快捷方式",64,"执行完毕"
WScript.quit
Sub Doit(strlnk)
Dim oShlnk
Set oShlnk = Wsh.CreateShortcut(strlnk)
If Instr(oShLnk.TargetPath,oldpath) > 0 Then
oShLnk.TargetPath = Replace(oShLnk.TargetPath,oldpath,newpath)
oShLnk.Save
ji_2 = ji_2 + 1
End If
Set oShLnk=NoThing
End Sub
Function Ask(strAction)
Dim intButton
intButton = MsgBox(strAction,vbQuestion + vbYesNo,"询问")
Ask = intButton = vbYes
End Function

