x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 

How to run a .bat file on a Windows CE Handheld PC using cmd.exe

CESD|200209

Applies To

  • Windows CE 2.11, 3.0, 4.0, 4.1, 4.2, 5.0, 6.0
  • Handheld PC Professional, HPC2000

Overview

This article outlines how you can register the .bat and .cmd file type extensions on your Windows CE device to allow for the manual or automatic (startup script) execution of a Batch (bat) or Command Script file (cmd).

More Info

By default, the Windows CE environment does not expose registrations for the bat file and cmd file types. In order to use these script types you will have to manually register the file extensions.

How-to Guide

You will require access to a registry editor in order to complete this article. If you require more information on using the Windows CE Registry see CESDS0006. If you require a Windows CE Registry Editor see CESDS0082.

WARNING: If you use a Registry Editor incorrectly, you may cause serious problems that may require you to hard reset your Handheld PC back to its factory installed configuration. Edit your Windows CE registry at your own risk.
[HKEY_CLASSES_ROOT\.bat]
@="cmdfile"

[HKEY_CLASSES_ROOT\.cmd]
@="cmdfile"

[HKEY_CLASSES_ROOT\cmdfile]

[HKEY_CLASSES_ROOT\cmdfile\DefaultIcon]
@=""\\Windows\\cmd.exe""

[HKEY_CLASSES_ROOT\cmdfile\Shell]

[HKEY_CLASSES_ROOT\cmdfile\Shell\Open]

[HKEY_CLASSES_ROOT\cmdfile\Shell\Open\Command]
@=""\\Windows\\cmd.exe /c %1""

Once you have entered the information correctly into the registry, soft reset your Handheld PC for the changes to take effect.