Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Running a batch file on CE 5.0.

2,367 views
Skip to first unread message

B

unread,
Mar 27, 2008, 11:52:42 AM3/27/08
to
I am unsuccessfully to run a batch file that I place in the my Startup
folder

\Hard Disk\Startup\Mybatch.bat

I can see following message displayed in the CMD window:
Pocket CMD v 5.0.
\Hard not found.


If try to run it from this location using |Start|run prompt then I can see
the same error displayed in the CMD window:
However if I move the batch file to the root folder \ and run it from there
there is no problem running it from the |Start|Run prompt. The run prompt
places " " around in both situations. It looks like the CMD window is not
able to find the file when the folder contains space.


Mike M. had same problem some years ago, but he did not get any response:

From: "Mike M." <nos...@someplace.com>
Dato: Tue, 28 Jun 2005 14:28:14 -0400
Lokalt: Ti. 28 Jun. 2005 19:28
Subject: Running a batch file on CE 5.0.
I have an image that I built for an x86 processor (Advantech PCM-3348). My
device uses a compact flash drive for storage and it shows as "Mounted
Volume" from Windows Explorer on my device. I am trying to run a batch file
to update some files that I ftp to the device. The batch file I run is also
ftp'ed to the device. My ftproot is \Mounted Volume\inetpub\ftproot. I
have found a problem with Pocket cmd in respect to running a batch file. I
created a simple batch file that does an echo and then a pause. When I
place this in the root folder I can double click it from Windows Explorer
and it runs fine. However, when I put it in a folder where the path
(\Mounted Volume) contains a space it won't run. I get the error:
"Pocket CMD v 5.0.
\Mounted not found."

It seems as if Pocket cmd is trying to ascertain the current working folder
and failing on the space in the path. I am looking for a work around for
this issue.

Mike M.


Paul G. Tobey [eMVP]

unread,
Mar 27, 2008, 1:12:57 PM3/27/08
to
It sounds to me like you have specified, somewhere in the batch file:

\hard disk\myprogram.exe some parameters

Just as with DOS, the space in "\hard disk" is interpreted as the end of the
command (which is, therefore "\hard", which of course is not a valid program
name).

Paul T.

"B" <NA> wrote in message news:eLBgYKCk...@TK2MSFTNGP04.phx.gbl...

Paul G. Tobey [eMVP]

unread,
Mar 27, 2008, 1:17:11 PM3/27/08
to
Ooops. Sent the message before completing the thought...

The batch file itself is not executable. It's treated like a data file by
the shell, and the association for .BAT files is with the command prompt.
So, there could be an error in the registry for your device that causes the
name of the batch file not to be quoted on the command line to cmd.exe.

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

If you see this sort of thing, you need to change it roughly as follows:

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

Or, if you're editing the registry directly using Remote Registry Editor,
which sounds like what you'll be doing, since it's Windows Mobile, just put
quotes around the %1 in the @ registry value.

Paul T.

"B" <NA> wrote in message news:eLBgYKCk...@TK2MSFTNGP04.phx.gbl...

B

unread,
Mar 27, 2008, 4:45:50 PM3/27/08
to
Thank you for your quick answer. This solved my problem.

Beggi

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:uNonj5C...@TK2MSFTNGP05.phx.gbl...

superclass

unread,
Apr 2, 2008, 7:03:00 AM4/2/08
to

"Paul G. Tobey [eMVP]" wrote:

> [HKEY_CLASSES_ROOT\cmdfile\Shell\Open\Command]
> @="\\Windows\\cmd.exe /c %1"
>
> If you see this sort of thing, you need to change it roughly as follows:
>
> [HKEY_CLASSES_ROOT\cmdfile\Shell\Open\Command]
> @="\\Windows\\cmd.exe /c \"%1\""
>
> Or, if you're editing the registry directly using Remote Registry Editor,
> which sounds like what you'll be doing, since it's Windows Mobile, just put
> quotes around the %1 in the @ registry value.

or you just type "\Hard Disk\Startup\Mybatch.bat" in your command prompt...


Paul G. Tobey [eMVP]

unread,
Apr 2, 2008, 11:21:13 AM4/2/08
to
That won't work. Just as on the desktop, if you have a space in the path to
the executable, you *must* quote the path, or the first space will be used
as the break between the program name (\Hard), and the first parameter
(Disk\Startup\Mybatch.bat).

Paul T.

"superclass" <super...@discussions.microsoft.com> wrote in message
news:1A1799A3-4D63-4A47...@microsoft.com...

superclass

unread,
Apr 4, 2008, 7:57:00 AM4/4/08
to

"Paul G. Tobey [eMVP]" wrote:

> That won't work. Just as on the desktop, if you have a space in the path to
> the executable, you *must* quote the path, or the first space will be used
> as the break between the program name (\Hard), and the first parameter
> (Disk\Startup\Mybatch.bat).

As I said he has to type "\Hard Disk\Startup\Mybatch.bat" WITH QUOTES.
It works.

Paul G. Tobey [eMVP]

unread,
Apr 4, 2008, 11:25:08 AM4/4/08
to
You're absolutely right. My apologies.

Paul T.

"superclass" <super...@discussions.microsoft.com> wrote in message

news:B067AEB1-AA2E-459B...@microsoft.com...

0 new messages