.BAT Execution for Pocket PC 2003

Posted on October 8, 2008. Filed under: Handheld Tangents |

By: Brenton Blawat

This article is designed to provide a quick reference to those who want to get the .BAT Execution on Pocket PC 2003. Since Pocket PC 2003 does not natively support command line, and further .BAT files, you have to manually setup the .BAT extension mapping within the registry.

Note: This “tweak” can be used for adding any .XXX extension per any customization of your desire.

1. To start, if you haven’t read my article Command Line (CMD.exe) for Pocket PC 2003 , you need to follow the instructions to get PocketCMD on the handheld device PRIOR to this section.

2. Open Notepad

3. Enter the exactly the following:

REGEDIT4

[HKEY_CLASSES_ROOT\.bat]
[HKEY_CLASSES_ROOT\.bat]
@="batfile"

[HKEY_CLASSES_ROOT\batfile\]
[HKEY_CLASSES_ROOT\batfile\DefaultIcon]
[HKEY_CLASSES_ROOT\batfile\DefaultIcon]
@="pword.exe,-110"
[HKEY_CLASSES_ROOT\batfile\Shell\]
[HKEY_CLASSES_ROOT\batfile\Shell\Open\]
[HKEY_CLASSES_ROOT\batfile\Shell\Open\Command]
[HKEY_CLASSES_ROOT\batfile\Shell\Open\Command]
@="cmd.exe /c %1"

Notes:

  • REGEDIT4 is utilized on Cold Boot to tell OS to import this file into the registry.
  • In Pocket PC, before you can write a string, dword, etc.. you have to instantiate the key. As displayed above, the  “duplicate” entries instantiates the key FIRST before then places the appropriate dwords in to the registry space.
  • The ‘DefaultIcon’ registry entry utilizes the notepad icon. This can be changed to any icon on the system.

Understanding the Key Flow:

REGEDIT4 ; tells the OS to import this .REG extension into the registry.

[HKEY_CLASSES_ROOT\.bat] ; instantiates the [HKEY_CLASSES_ROOT\.bat] key
[HKEY_CLASSES_ROOT\.bat] ; Calls [HKEY_CLASSES_ROOT\.bat] key
@="batfile" ; associates the .bat extension to the batfile function key

[HKEY_CLASSES_ROOT\batfile\] ; instantiates the [HKEY_CLASSES_ROOT\batfile\] key
[HKEY_CLASSES_ROOT\batfile\DefaultIcon] ; instantiates the […batfile\DefaultIcon] key
[HKEY_CLASSES_ROOT\batfile\DefaultIcon] ; calls the […batfile\DefaultIcon] key
@="pword.exe,-110" ; associates the pword (pocket word) executable icon to .bat
[HKEY_CLASSES_ROOT\batfile\Shell\] ; instantiates the […\batfile\Shell\] key
[HKEY_CLASSES_ROOT\batfile\Shell\Open\] ; instantiates the […\batfile\Shell\Open\] key
[HKEY_CLASSES_ROOT\batfile\Shell\Open\Command] ; instantiates the ..\Open\Command] key

[HKEY_CLASSES_ROOT\batfile\Shell\Open\Command] ; calls the ..\Open\Command] key
@="cmd.exe /c %1" <— opens the cmd.exe ; /c tells the cmd to close after execution; %1 to execute any variables after….

So… the end result is executing cmd.exe /c batfilename.bat

Sample .BAT Execution .REG file can be downloaded here:

http://www.brentblawat.com/Downloads/MMPT/batsetup.zip

Make a Comment

Make a Comment: ( None so far )

blockquote and a tags work here.

    About

    Business and Information Technology Tangents is dedicated to providing quality content while informing the world about technology.

    RSS

    Subscribe Via RSS

    • Subscribe with Bloglines
    • Add your feed to Newsburst from CNET News.com
    • Subscribe in Google Reader
    • Add to My Yahoo!
    • Subscribe in NewsGator Online
    • The latest comments to all posts in RSS
    • Subscribe in Rojo

    Meta

Liked it here?
Why not try sites on the blogroll...