Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: Profil Naturesk
| Femeie 25 ani Bucuresti cauta Barbat 25 - 47 ani |
|
Mrrrr
AdMiN
Inregistrat: acum 17 ani
Postari: 2237
|
|
Source:
Put this in a vbs file and run in the cmd with the argument being the folder the folders are in, eg: you should run "EditDesktopIni e:\movies" in the cmd window
' Run with cmd: EditDesktopIni E:\ZG
EditDesktopIni(Wscript.Arguments(0))
Sub EditDesktopIni(foldpath) Dim fso, inifile, icondata, file, fold, subfold, item, subfoldpath Const ForReading = 1, ForWriting = 2 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Set fso = CreateObject("Scripting.FileSystemObject") Set fold = fso.GetFolder(foldpath) Set subfold = fold.SubFolders For Each item In subfold inifile = foldpath + "\" + item.Name + "\desktop.ini" subfoldpath = foldpath & "\" & item.name If (fso.FileExists(inifile)) Then ' if desktop.ini exists, delete it fso.DeleteFile inifile, True End If Set file = fso.OpenTextFile(inifile, ForWriting, True, TristateUseDefault)
file.WriteLine "[.ShellClassInfo]" file.WriteLine "IconResource=" & subfoldpath & ".ico" & ",0" file.WriteLine "[ViewState]" file.WriteLine "Mode=" file.WriteLine "Vid=" file.WriteLine "FolderType=Generic" file.WriteLine ""
fso.GetFile(inifile).Attributes = 6 item.Attributes = 0 item.Attributes = 4 ' set the folder to system to refresh the icon Next End Sub
|
_______________________________________
|
|
pus acum 5 ani |
|
Mrrrr
AdMiN
Inregistrat: acum 17 ani
Postari: 2237
|
|
' A slightly modified version by me in which you insert Folder path and ICO index from a DLL specified in the code below:
Dim fso, inifile, icoNum, file, item, foldpath, fold
' this is the path of the folder you want to change icon foldpath = inputbox("Please enter complete folder path", "String")
' this is the index number of the icon in D:\TOOLBAR-DLL\IconLibrary.dll icoNum = inputbox("Insert icon index from DLL file", "String") Const ForReading = 1, ForWriting = 2 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Set fso = CreateObject("Scripting.FileSystemObject") Set fold = fso.GetFolder(foldpath) inifile = foldpath + "\" + "\desktop.ini"
If (fso.FileExists(inifile)) Then ' if desktop.ini exists, delete it fso.DeleteFile inifile, True End If Set file = fso.OpenTextFile(inifile, ForWriting, True, TristateUseDefault)
file.WriteLine "[.ShellClassInfo]" file.WriteLine "IconResource=D:\TOOLBAR-DLL\IconLibrary.dll," & icoNum file.WriteLine "[ViewState]" file.WriteLine "Mode=" file.WriteLine "Vid=" file.WriteLine "FolderType=Generic" file.WriteLine ""
fso.GetFile(inifile).Attributes = 6 fold.Attributes = 0 fold.Attributes = 4 ' set the folder to system to refresh the icon ' refresh icons - still doesn't work instantly unfortunately Dim objWshShell Set objWshShell = WScript.CreateObject("WScript.Shell")
objWshShell.Run "ie4uinit.exe -cleariconcache" WScript.Sleep(1000) objWshShell.Run "ie4uinit.exe -show" WScript.Sleep(1000) |
_______________________________________
|
|
pus acum 5 ani |
|