Click here to learn
about this Sponsor:
Home  |  News  |  Articles  |  Polls  |  Forum  |  Directory

Keywords: Match:
The Windows XP Embedded Command-Line Tool
by Matt Kellner (Oct. 11, 2006)

Foreword: This whitepaper, second in our series leading up to the Nov. 1 official launch of Windows XP Embedded SP2 Feature Pack 2007, discusses the newly redesigned command line scripting tool, offering some history and a couple of examples where it is particularly useful.



The Windows XP Embedded Command-Line Tool

Improving the developer experience through a command line tool to script XP Embedded builds, edit configurations, and mine the database

by Matt Kellner
In 2002, Windows XP Embedded Service Pack 1 shipped a command-line tool called CMI Explorer. This tool was a simple value-add script that provided some of the functionality also available in Target Designer and Component Database Manager. The original version of this tool was challenging to use and poorly documented; and it didn't provide a lot of value to our customers. Overall, our customers challenged us to update the tool to better automate their build processes and perform various tasks with it. This interest in a command-line tool (and particularly scripting capability) remained high.

When I took over development of CMI Explorer in January 2006, I set out to understand the most common customer scenarios and requests for our tools. The most common request was, by far, a way to automate Target Designer; particularly to be able to make small changes to a configuration and build it without having to manually work with the graphical user interface (GUI) every time. Other customers wanted a way to efficiently import their custom components without having to use Component Database Manager, and many requested the ability to trace component dependency relationships (something none of our existing tools provided directly).

After several months of research and development, we released a new version of this tool, simply called "Windows XP Embedded Command-Line Tool," or XPECMD for short. XPECMD enables many developer scenarios and can greatly improve a developer's productivity -- among its top features:
  • A powerful command-line interface to modify and build configurations
  • Easy-to-use Single-Quote Expression (SQE) engine makes it simple to look up components by name, Globally Unique Identifier (GUID) or revision.
  • Reduction in overall development time by simplifying the developer experience
  • Script through the use of flexible "response files," which can be created manually or on the fly by automation
  • Interface to research component dependency relationships
  • Import into and administer component databases
Here's an example of what you can do with XPECMD: A common task in Target Designer is to open an existing configuration; add or change a component; resolve dependencies; then build the resulting runtime image. In TD, this process can be somewhat slow and cumbersome, and there's really no way to automate it. If you need to perform the same task across multiple configuration files, dealing with the GUI can become a serious burden.

In XPECMD, however, you need just a few commands to perform the same task. For example, say you want to add a new User Account to your configuration. You can leverage XPECMD's powerful Single-Quote Expression (SQE) syntax to add a new component instance to your configuration, and the whole process can be done in just a few easy steps:

xpecmd> dbo MYSERVER
xpecmd> load myConfig "c:\myImages\myConfig.slx"
xpecmd> new myInst = 'inst:^User Account'
xpecmd> add myConfig myInst
xpecmd> myInst.Properties("cmiUserName") = "Matt"
xpecmd> myInst.Properties("cmiPassword") = "SomePassword"
xpecmd> myInst.Properties("cmiUserGroup") = 0
xpecmd> myConfig.ResolveDependencies 2
xpecmd> save myConfig "c:\myConfigs\myConfig.slx"
xpecmd> Build myConfig "c:\myImages\myImage1"

This code can run in as little as 10-15 seconds, depending on the complexity of your runtime. To make it even more convenient, you can write this into a response file and set it up so it can take parameters for the config and runtime image paths. Then you can easily automate the process across multiple files,
running them all as a batch in a fraction of the time it would take to do all this in TD.

Another useful feature of XPECMD is the ability to trace component dependencies both directions. Using the DEPTREE and SHOW commands, you can easily see a component's dependencies - DEPTREE also allows you to see an entire tree of component dependencies if you so desire. Meanwhile, the DEPTRACE command allows you to see which components depend on a specific component. As an example, let's look at the forward and reverse dependencies of Enhanced Write Filter:

xpecmd> new c = 'comp:Enhanced Write Filter'
xpecmd> show c.Dependencies
Dependencies: [14 items]
----- ------------
Index: Value
----- ------------
12: Dependency on "Disk Management Basic Volume Runtime" caused by "FTDISK.SYS"
11: Dependency on "Microsoft Visual C++ Run Time" caused by "MSVCRT.DLL"
13: Dependency on "PnP (User-mode)" caused by "CERTCLAS.INF"
14: Dependency on "Primitive: Umpnpmgr" caused by "UMPNPMGR.DLL"
2: Enhanced Write Filter build before Class Installer - Storage volumes
1: Enhanced Write Filter build before Volume Shadow Copy Service
9: Enhanced Write Filter depends on Class Installer - Storage volumes
10: Enhanced Write Filter depends on EWF NTLDR
3: Enhanced Write Filter depends on Loader
4: Primitive: Ntdll
5: Primitive: Setupapi
6: Win32 API - Advanced
7: Win32 API - Kernel
8: Win32 API - User

xpecmd> deptrace revdeps c
Analyzing Database... 100%
Components: [2 items]
----- ------------
Index: Value
----- ------------
2: El Torito CD [R2890]
1: Enhanced Write Filter API (EWF API) [R2890]

XPECMD has many other ways to improve your productivity, but as I showed in the few examples above, this utility should enable XP Embedded developers to be more productive, more easily search for information in their configurations or in the database, and finally, incorporate the XPe build process into existing build environments. Be sure to check out the new tool (included in the Tools Update of Feature Pack 2007 CTP) and the "How To" document available on the Microsoft Connect site.

You can find more information about the Windows XPe product at its homepage on MSDN. You can also download a Community Technology Preview version of FP 2007 from the Microsoft Connect Site -- sign up for the CTP using this Invitation ID: 123-BC7M-6GVK.


Copyright (c) 2006 Microsoft Corp. All rights reserved. Reproduced by WindowsForDevices.com with permission.



About the author: Matt Kellner is a test engineer on the Windows Embedded team who describes himself as a "jack-of-all-trades," providing various testing services and developing tools for several different groups within the team. Matt has been using and programming computers since he was a kid and says he is "passionate about the quality of my work."



Read the Complete XPe SP2 FP2007 Whitepaper Series



Other Related Stories


(Click here for further information)


Windows XP for Embedded Applications
This white paper describes the benefits of using Windows XP when developing embedded applications.

A Manager's Guide to Selecting a Mobile Device Operating System
This white paper offers a comparative review of Microsoft Windows CE and Windows Mobile.

Visual Basic 6.0 to .NET Migration
This paper focuses on the methodology and techniques which Infosys (Microsoft Technology Center) has developed for migrating VB 6.0 Applications to .NET. Our approach ensures a smooth, cost effective, and efficient migration.

Mobile Device Security: Securing the Handheld, Securing the Enterprise
This whitepaper identifies security threats to corporate data on mobile devices and details how mobile devices can become a "backdoor" to the enterprise.

Mobile Device Security: The Eight Areas of Risk
It's common knowledge that adding mobile devices to your network increases security risks. There are multiple facets to mobile security, all of which should be paid close attention to. This E-Guide presents a more in depth look into the eight key areas of securing wireless devices.

Quality Assurance and .NET
This paper discusses best practices for functional, regression and load testing of .NET applications.

SCADA Security in Integrated Networks
As businesses leverage their SCADA systems by integrating them into the business networks, they must also assure the security of the SCADA system.

The Advantages of Small Form Factor HMI
HMIs have mutated and changed with new requirements, and they have become more flexible and capable. And while they've been doing that, they've become smaller and more useful.

9 Critical Requirements for Web Application Security
Learn why your Web applications expose dangerous security breaches and what’s required to effectively protect your Web applications and the sensitive information behind them.

 


Got a HOT tip?   please tell us!
Free weekly newsletter
Enter your email...
Click here for a profile of each sponsor:
PLATINUM SPONSORS
(Become a sponsor)

ADVERTISEMENT
(Advertise here)

Updated! The latest Windows-powered...

mobile phones!

other cool
gadgets

HOT TOPICS
Microsoft targets PNDs with new embedded OS
Microsoft tips .NET MF 3.0 highlights
Microsoft previews Windows Embedded Standard
Microsoft offers free Windows CE 6.0 textbook
Microsoft renames embedded operating systems
Microsoft unveils Windows Mobile 6.1
New Atom models target low-cost PCs
REFERENCE GUIDES
Windows Device Showcase
Intro to Windows Embedded
Intro to Shared Source
Real-time Windows Embedded
Windows Embedded books
Join our Windows Embedded discussion forums:
Windows XP Embedded
Windows CE
Windows Mobile


Windows Embedded developer newsgroups
Windows CE
XP Embedded
PocketPC
Smartphone

Microsoft's Windows Embedded resources
Embedded dev center
Mobile dev center
Windows CE tutorials
XP Embedded tutorials
Windows Embedded seminars
Windows Embedded application categories
3rd-party partners


BREAKING NEWS

• Cortex-A8 SBCs target signage and kiosks
• Student competition offers a different kind of fireworks
• Windows CE SBC targets HMI development
• All-you-can-eat carrier launches -- sort of
• Adeneo and IntervalZero promote "soft-control" architecture
• App creates virtual serial ports in Windows CE
• Windows satellite phone service takes off (literally)
• Bsquare and Microsoft renew key distribution agreement
• Software syncs HTC phones with Macs
• Electricity meter runs Windows, talks to Google
• Windows device is two phones in one
• MIcrosoft's online store to debut with 600 Windows Mobile apps
• Windows Mobile gets upgraded Skype VoIP client
• Panel PC targets outdoor use
• Samsung shrinks ARM11 application processor


MOST POPULAR (last 90 days)
• "Netbook" uses Intel's Atom N270
• Windows CE takes on Linux in low-end netbooks
• HTC ups Touch resolution
• Microsoft unleashes new embedded OS
• Windows Mobile phone gets 800 x 480 display
• HTC spins WiMAX phone?
• Smart camera sports Atom
• Dual-core AMD netbook gets rave review
• Windows Mobile 7 "delayed"
• GPS phone uses new Marvell "Tavor" chip
MOST POPULAR (Classics from the vault)
Windows XP Embedded USB boot
Troubleshooting Windows XPe's blue screen "Stop 0x0000007B" error
Asus reveals $190 mini notebook
Windows Mobile 6 SDKs available for download
Windows Mobile VPN client plays with Cisco
HTC adds GPS to Windows Mobile Touch line
Microsoft unveils Windows Mobile 6.1
Guide to HTC's Windows Mobile smartphone platforms
• HTC releases Touch Diamond ROM upgrade
Customizing Windows XP Embedded thin clients

Also visit our sister sites:


Sign up for WindowsForDevices.com's...

news feed

Or, follow us on Twitter...



Home  |  News  |  Articles  |  Polls  |  Forum  |  Directory  |  About  |  Contact
 

Ziff Davis Enterprise Home | Contact Us | Advertise | Link to Us | Reprints | Magazine Subscriptions | Newsletters
Tech RSS Feeds | White Papers | ROI Calculators | Tech Podcasts | Tech Video | VARs | Channel News

Baseline | Careers | Channel Insider | CIO Insight | DesktopLinux | DeviceForge | DevSource | eSeminars |
eWEEK | Enterprise Network Security | LinuxDevices | Linux Watch | Microsoft Watch | Mid-market | Networking | PDF Zone |
Publish | Security IT Hub | Strategic Partner | Web Buyer's Guide | Windows for Devices

Developer Shed | Dev Shed | ASP Free | Dev Articles | Dev Hardware | SEO Chat | Tutorialized | Scripts |
Code Walkers | Web Hosters | Dev Mechanic | Dev Archives | igrep

Use of this site is governed by our Terms of Service and Privacy Policy. Except where otherwise specified, the contents of this site are copyright © 1999-2008 Ziff Davis Enterprise Holdings Inc. All Rights Reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff Davis Enterprise is prohibited. Windows is a trademark or registered trademark of Microsoft Corporation in the United States and/or other countries and is used by WindowsForDevices under license from owner. All other marks are the property of their respective owners. WindowsForDevices is an independent publication not affiliated with Microsoft Corporation.