This script with add/modify comments on folders via the Desktop.ini, to do this it makes the folder a system folder.
I couldn't figure out how to get explorer to reliably refresh but know that eventually the comments you choose will appear.
Use the script by installing AutoHotkey, double clicking on the script, and pressing alt + z.
;
; ==========================================================================================================
; Author : LifeWeaver <
[email protected]>
; Script Name : SetFolderComments
; Script Version :
; Homepage :
;
; Creation Date : 08/07/2015
; Modification Date :
;
; Description : Lets you set comments on a folder via Desktop.ini
; ===================
;
; ----------------------------------------------------------------------------------------------------------
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
ActiveExplorerWindow()
{
for window in ComObjCreate("Shell.Application").Windows
if window.HWND = WinExist("A")
return window
}
ExplorerItemsSelected(window)
{
return window.Document.SelectedItems().count
}
SetFolderComments(folderPath, comments)
{
desktopIniPath := folderPath . "\desktop.ini"
ifExist %desktopIniPath%
{
; desktop.ini file exists edit the InfoTip
FileRead, desktopIniContents, %desktopIniPath%
}
else
{
; set default desktop.ini contents
desktopIniContents := "[.ShellClassInfo]`nInfoTip=`n"
}
FileDelete, %desktopIniPath%
desktopIniContents := RegExReplace(desktopIniContents, "(?<=InfoTip=).*$", comments)
FileAppend, %desktopIniContents%, %desktopIniPath%
if(ErrorLevel)
{
msgbox problem(%A_LastError%) appending to %desktopIniPath%
}
else
{
; Had issues with permission, running via hidden cmd
Run, %comspec% /c attrib +S "%folderPath%" && attrib +H +S +A "%desktopIniPath%",,Hide
}
; Update explorer
DllCall( "Shell32\SHChangeNotify", UInt,0x08000000, UInt,0, Int,0, Int,0 ) ; SHCNE_ASSOCCHANGED
}
RemoveFolderComments(folderPath)
{
IniDelete, %folderPath%, .ShellClassInfo, InfoTip
}
#IfWinActive
!z::
window := ActiveExplorerWindow()
InputBox, comment, Folder Comment, Enter folder(s) comment
; if an item(s) is/are selected set the comment on all files selected
if(ExplorerItemsSelected(window))
{
for item in window.Document.SelectedItems()
SetFolderComments(item.Path, comment)
}
else
{
folderPath := window.Document.Folder.Self.path
SetFolderComments(folderPath, comment)
}
return
is need to run this script, although you could compile it and merely have an .exe.