Getting Command Shell working on Windows Mobile 5

Microsoft provide a command shell for Windows Mobile as a part of their Developer Power Tools package.

I fancied giving it a try tonight (for no particular reason other than that I like using the command line, and my phone has a full QWERTY keyboard) so followed the instructions to install it.

No luck – it didn’t work. No errors, it just didn’t work – nothing happened.

It took a bit of playing around with, but I’ve managed to get it running…

It needed a registry hack:

set HKEY_LOCAL_MACHINE\Drivers\Console\OutputTo to 0.

I did it with a quick bit of code:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;

namespace RegistryAccess
{
    class Program
    {
        static void Main(string[] args)
        {
            RegistryKey baseKey = Registry.LocalMachine;
            RegistryKey driversKey = baseKey.OpenSubKey("Drivers", true);
            RegistryKey consoleKey = driversKey.OpenSubKey("Console", true);
            consoleKey.SetValue("OutputTo", 0);
        }
    }
}

but if you have a registry editor, you can do it with that. (I’m short of space on my phone at the moment, so have uninstalled every non-essential app, including my registry editor.)

Then after a reboot, the command shell seems to be working.

The only downside is that it doesn’t seem to realise it’s running on a VGA screen, so the text is really small. But still… I have a command line now – yay! 🙂

Update: My first mobile command-line app was a port of my command-line To-Do list tools – after a quick try, they seem to work fine. I quite like this – it’s actually quicker than navigating to and filling in the Pocket Outlook forms to just enter the text I want then hit Enter.

13 Responses to “Getting Command Shell working on Windows Mobile 5”

  1. Michael Maryahin says:

    Thank you so much indeed, Dale.

    This post is VERY useful. I have gotten workable the most useful things for my Pocket PC Windows Mobile.

    Best wishes,
    Michael.

  2. dale says:

    Thanks for the comment! Glad you found it useful

  3. edi says:

    If you are short on space and need a reg editor: today i found ceregeditor.mdsoft.pl.

  4. Dan Devine says:

    Hey Dale,

    I really appreciate your experimenting on this too. I’m working on the emulator, and needed a way to do “interactive” test applications.

    One thing that I discovered while using this fix, is that while the output is directed back to the device, there is no output for the debugger in Visual Studio! When using the remote registry editor, remember to write down the original value of the output target so that you can set it back to Visual Studio when you want.

    Did you see this too?

    Thanks,
    DD

  5. dale says:

    @Dan – I’ve not seen this myself before, but thanks for the tip! Dale

  6. Rabinovich says:

    Thank you very much for this tip, it worked on the HTC Rhodium Windows Mobile 6.1 platform!

  7. Pronichkin says:

    Hi!

    Have anybody tried this on WM6.5? Interestingly, the console seems to work fine by itself. But I can’t type anything directly into it. The only button that seems to work OK is Enter.

    But if I type somewhere else and then copy-paste into the console this works and commands execute perfectly.

    What could be the trouble? Thanks in advance.

  8. Touch_Pete says:

    Tried this on my HTC Rhodium and it works but you have to use a soft keyboard the physical one doesn’t work.

  9. TrueG says:

    dale, can you tell me what I would need to do in order to use that bit of code is listed in this post? I’m trying to build a small exe that changes a registry entry and it looks like your code does exactly that. I’m trying to use eVC++ 4 since I don’t have VS2005 or 2008. Thanks

  10. dale says:

    TrueG – the code is C#, so you will need something able to compile .NET CF code. I use VS2005.

  11. Th30 says:

    “Pronichkin says: …I can’t type anything directly into it. The only button that seems to work OK is Enter…”

    I have the same problem on my HTC Touch Pro2 running WM6.5. Enter, Backspace and the smiley buttons work, but that’s all.

    Did nobody find a solution for that? PocketConsole was even worse. It keeps on spewing errors.

  12. Th30 says:

    I found the solution to the keyboard issue on WM6.5 here:
    http://forum.xda-developers.com/showthread.php?t=606393&page=3

    Either go into the options of the soft keyboard and select the compact version (a bit harder to type, but hey), or install yourself another soft keyboard. The compact one is gooed enough for my purposes. Thanks for the suggestions!

  13. Th30 says:

    Haha, scratch that. It’s not the compact version, but the XT9 that makes it work. And there’s no spaces on there.