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

所属分类: 脚本专栏 / vbs 阅读数: 1732
收藏 0 赞 0 分享

复制代码 代码如下:

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 "完成!"

更多精彩内容其他人还在看

VBS教程:函数-LCase 函数

VBS教程:函数-LCase 函数
收藏 0 赞 0 分享

VBS教程:函数-LBound 函数

VBS教程:函数-LBound 函数
收藏 0 赞 0 分享

VBS教程:函数-Join 函数

返回一个字符串,此字符串由包含在数组中的许多子字符串联接创建
收藏 0 赞 0 分享

VBS教程:函数-IsObject 函数

VBS教程:函数-IsObject 函数
收藏 0 赞 0 分享

VBS教程:函数-IsNumeric 函数

VBS教程:函数-IsNumeric 函数
收藏 0 赞 0 分享

VBS教程:函数-IsNull 函数

VBS教程:函数-IsNull 函数
收藏 0 赞 0 分享

VBS教程:函数-IsEmpty 函数

VBS教程:函数-IsEmpty 函数
收藏 0 赞 0 分享

VBS教程:函数-IsDate 函数

VBS教程:函数-IsDate 函数
收藏 0 赞 0 分享

VBS教程:函数-IsArray 函数

VBS教程:函数-IsArray 函数
收藏 0 赞 0 分享

VBS教程:函数-Int、Fix 函数

VBS教程:函数-Int、Fix 函数
收藏 0 赞 0 分享
查看更多