XPECMD is the command-line utility that provides a scriptable interface to the Windows XP Embedded tools. The documentation is ok for the basics, but it does seem like it was a bit of an afterthought and they did miss some things out.

I wanted, as part of my automated build script, to change the desktop background for my deployment image. This involves changing a couple of registry settings, both of which exist as resources on the “Windows API – User” component, but the docs don’t tell you how to modify component resources. I eventually found this post on the Windows Embedded blog that explains how to do it. The hard part is that you can only refer to the resources by index, not display name, so you first have to figure out the indexes by dumping an existing object and trawling through until you find the right one.

Once you have the index, you can do something like:

myInst.Resources[169].Properties("RegValue") = "c:\wallpaper.bmp"

where [169] is the index for the desktop wallpaper registry setting. Let’s hope it doesn’t change!