萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> 編程語言綜合 >> 通過vbs修改目錄名稱與快捷方式名稱的實現代碼

通過vbs修改目錄名稱與快捷方式名稱的實現代碼

這篇文章主要是分享了如果用vbs修改目錄名與快捷方式名稱的代碼,需要的朋友可以參考下   復制代碼 代碼如下:


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 SettingsAll Users「開始」菜單程序"
newpath="C:Documents and SettingsAll Users「開始」菜單程序Peacemap Messenger"
deskpath="C:Documents and SettingsAll 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 "完成!"

copyright © 萬盛學電腦網 all rights reserved