欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

通过vbs修改目录名称与快捷方式名称的实现代码

程序员文章站 2022-07-06 12:58:06
复制代码 代码如下:set fso=wscript.createobject("scripting.filesystemobject") oldfoldername1="...

复制代码 代码如下:

set fso=wscript.createobject("scripting.filesystemobject")

oldfoldername1="263 enterprise messenger"
newfoldername1="peacemap messenger"
oldfilename1 = "263 enterprise messenger.lnk"
newfilename1 = "peacemap messenger.lnk"
oldfilename2 = "卸载 263 enterprise messenger.lnk"
newfilename2 = "卸载 peacemap messenger.lnk"

originalpath="c:\documents and settings\all users\「开始」菜单\程序"
newpath="c:\documents and settings\all users\「开始」菜单\程序\peacemap messenger"
deskpath="c:\documents and settings\all users\桌面"

if (fso.folderexists(originalpath & "\" & oldfoldername1)) then
  set fsogetfolder = fso.getfolder(originalpath & "\" & oldfoldername1)
  fsogetfolder.name = newfoldername1
end if


if fso.fileexists(newpath&"\"&oldfilename1 ) then
 set f=fso.getfile(newpath&"\"&oldfilename1)
 f.name=newfilename1
end if

if fso.fileexists(newpath&"\"&oldfilename2 ) then
 set f=fso.getfile(newpath&"\"&oldfilename2)
 f.name=newfilename2
end if

if fso.fileexists(deskpath&"\"&oldfilename1 ) then
 set f=fso.getfile(deskpath&"\"&oldfilename1)
 f.name=newfilename1
end if

msgbox "完成!"