Skif_off
Gold Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Код: Option Explicit Const ReadOnly = 1 Const Hidden = 2 Const System = 4 Dim strSourceFolder Dim objFSO Dim objFile Dim WshShell Dim strDesktopIniFile If WScript.Arguments.Count = 1 Then strSourceFolder = WScript.Arguments.Item(0) Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") If objFSO.FolderExists(strSourceFolder) Then strDesktopIniFile = objFSO.BuildPath(strSourceFolder, "desktop.ini") For Each objFile In objFSO.GetFolder(strSourceFolder).Files If StrComp(objFSO.GetExtensionName(objFile.Name), "ico", vbTextCompare) = 0 Then If Not StrComp(objFile.Name, objFSO.GetBaseName(strSourceFolder) & ".ico", vbTextCompare) = 0 Then objFile.Name = objFSO.GetBaseName(strSourceFolder) & ".ico" End If objFile.Attributes = objFile.Attributes Or Hidden If objFSO.FileExists(strDesktopIniFile) Then With objFSO.GetFile(strDesktopIniFile) .Attributes = .Attributes And Not (System Or Hidden) End With End If With objFSO.CreateTextFile(strDesktopIniFile, True) .WriteLine "[.ShellClassInfo]" .WriteLine "IconResource=" & objFile.Name & ",0" If Left(objFSO.GetFileVersion("C:\Windows\System32\ntdll.dll"), 2) <> "6." Then .WriteLine "IconFile=" & objFile.Name .WriteLine "IconIndex=0" End If .Close End With With objFSO.GetFile(strDesktopIniFile) .Attributes = .Attributes Or (System Or Hidden) End With With objFSO.GetFolder(strSourceFolder) .Attributes = .Attributes Or ReadOnly End With Exit For End If Next Set WshShell = CreateObject("WScript.Shell") WshShell.Run """" & objFSO.GetParentFolderName(Wscript.ScriptFullName) & "\winapiexec64.exe"" shell32.dll@SHChangeNotify 0x00001000 0x00000001 """ & WScript.Arguments.Item(0) & """ 0", 0, True Else WScript.Echo "Can't find source folder [" & strSourceFolder & "]." WScript.Quit 2 End If Set objFSO = Nothing Else WScript.Echo "Usage: cscript.exe //nologo """ & WScript.ScriptName & """ <Source folder>" WScript.Quit 1 End If WScript.Quit 0 |
| Всего записей: 6489 | Зарегистр. 28-01-2008 | Отправлено: 12:14 16-08-2018 | Исправлено: Skif_off, 16:21 16-08-2018 |
|