The application directory bundle shell hack

In the words of the great Raymond Chen: In Windows, the directory is the application bundle but that is a poor excuse for the lack of some kind of application bundle or fat binary support. I usually don’t care about eye candy but it would be nice (and a fun experiment) if we could get a application directory to look and act like a real application bundle.

Folder icon customization has been around for years but desktop.ini got a new feature in Win7; you can add custom verbs to the context menu. This will enable us to take over the default action and do whatever we want when the folder is double clicked!

We begin with a pretty standard looking desktop.ini:


DirectoryClass is used to specify the ProgId with our special verb and ExecAppFolder:Cmd is a custom entry I made up and it contains the command we actually want to execute (%% will be replaced by the folder path)

Next up is the registry entry for our ProgId:

Windows Registry Editor Version 5.00



@="Run Application"


The hex goo is just the string wscript "%SystemRoot%\Resources\WndSks.ExecAppFolder.wsf" "%1" and this little WSH script is the final piece of the puzzle:

<?xml version="1.0"?><package><job><script language="JScript"><![CDATA[
var WS=WScript,

function IniGetValFromLines(lines,sec,name)
	// WSH does not have INI support?
	// We don't need true INI handling so we just fake it
	if (-1!=beg) {
		return lines.substr(beg).split("\r",2)[0].split("\n",2)[0];	
	return null;

if (1==a.Length) {
	if (cmd) {

I used to store this kind of shell stuff in %WINDIR%\system32\ShellExt but I don’t think that folder is used much these days so I just stuck it in Resources to get it out of the system root.

For the icon handling to work you need to make the folder read only (or system) and +s+h on desktop.ini to make it superhidden.

To install this as a single user you should replace HKEY_CLASSES_ROOT with HKEY_CURRENT_USER\Software\Classes and store the .wsf somewhere in your profile.

It should be noted that D&D does not work. It might be possible to work around this by creating a DropHandler but then this would not be a “Notepad only” hack 😉

It might even be possible to implement the menu and double click handling on older windows versions by using the CLSID and/or UICLSID hooks and some horrible hacks in the COM namespace handling but for now this is Win7+ only…


Tags: , , ,

One Response to “The application directory bundle shell hack”

  1. Anonymous Says:

    Wow didn’t know about this desktop.ini custom verbs feature. Desktop.ini also lost the ability to customize the folder background in W7 because ListView is not the default control in Explorer (but can be made the default one using a reg hack).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s