开发者

Creating a shell right click menu item to edit desktop.ini

I am trying to create a right click shell menu item to edit desktop.ini. I have managed to get this far:

[HKEY_CLASSES_ROOT\Folder\shell\editdesktop]
@="editdesktop"

[HKEY_CLASSES_ROOT\Folder\shell\editdesktop\command]   
@="notepad "%L/desktop.ini"

use the cmd command to create an desktop.ini and append the following format to the desktop.ini file ,Then open it(desktop.ini) with notepad.exe

/* Format start */

[.ShellClassInfo]   
InfoTip= 
ConfirmFi开发者_运维百科leOp=0w

/* Format  end */

// ps: i just want to creat the folder InfoTip , ,when i hover the folder,it will so 2 me.


CMD.exe nor Windows Scripting Host has .ini support so implementing this without overwriting is a bit risky, you also need to set the correct attribute on the folder and this could be SYSTEM or READONLY depending on a registry key!

This example should work in the default windows configuration and tries its best to not overwrite a existing file:

[HKEY_CLASSES_ROOT\Folder\shell\editdesktop\command]
@="cmd /C ((if not exist \"%L\\desktop.ini\" (>\"%L\\desktop.ini\" (echo.[.ShellClassInfo]&echo.InfoTip=&echo.ConfirmFileOp=0w)))&attrib +s \"%L\"&attrib +h +s \"%L\\desktop.ini\"&start notepad \"%L\\desktop.ini\")"

It is probably a better idea to write a WSH or powershell script...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜