Reputation: 131
My script is not executing on Windows CE version 8.
I am getting a file path from the user as input, appending the filename and attempting to 'start' it.
But the @ echo off
isn't considered and all commands are shown in the console when runing in the device. Also, none of the start commands nor the set /p
command is run. Error is shown
@ echo off
if exist clientshutdown3.exe (
start clientshutdown3.exe
start ConmanClient3.exe
start CMAccept3.exe
start MSVSMON.EXE
) else (
set /p mypath=Enter path of pdf file:
)
if defined mypath start "" "%mypath%\clientshutdown3.exe"
if defined mypath start "" "%mypath%\ConmanClient3.exe"
if defined mypath start "" "%mypath%\CMAccept3.exe"
if defined mypath start "" "%mypath%\MSVSMON.EXE"
Upvotes: 3
Views: 4189
Reputation: 41784
According to wikipedia the console in WinCE is also cmd.exe. However they're not the same cmd.exe, so their functionality will be different
From the list of Command Processor Commands (Windows CE 5.0) on MSDN it seems Windows CE's cmd.exe is very primitive and more like command.com than Windows NT's cmd.exe. For example it doesn't support exit /B
or copy /B
and so on. Similarly it doesn't have set /P
, set /A
or set "with=quote"
and supports only
SET [variable=[string]]
I've also found another detailed list of Script Commands for Windows Mobile Devices. In this list the if
command is claimed to have only the below forms
if [not] errorlevel number scriptCommand
if [not] string1==string2 command
if [not] exist filename command
if [not] procexists processName command
There's no if defined
in this list. However the document on MSDN disagrees, as it doesn't list the strange procexists
form but the IF [NOT] DEFINED variable command
one
Nevertheless, both agree that if
can't have an else
, thus your if/else block won't work either. And even if it has if defined
, the last lines in your script won't work because you used start ""
which isn't available in WinCE. You must use START command [parameters]
instead
if/else
, set /P
and start ""
(and possibly if defined
)Upvotes: 1
Reputation: 5108
The Windows CE command shell is not nearly as powerful as it's NT brothers. Set /P is not supported under CE.
The shell hasn't changed since v5. (https://en.wikipedia.org/wiki/Windows_Embedded_Compact)
Here are a list of the v5 supported commands and their parameters. http://nellisks.com/ref/dos/ce/SET.html
You can easily code this behavior up using another language if you really need to solve this using the shell.
Good luck.
Upvotes: 2