我的脚本未在Windows CE版本8上执行。
我从用户获取文件路径作为输入,附加文件名并尝试“启动”它。
但是不考虑@ echo off
,并且在设备中运行时所有命令都显示在控制台中。此外,没有启动命令和set /p
命令。显示错误
@ 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"
根据维基百科the console in WinCE is also cmd.exe。但是它们不是同一个cmd.exe,因此它们的功能会有所不同
从MSDN上的Command Processor Commands (Windows CE 5.0)列表看来,Windows CE的cmd.exe非常原始,更像是command.com而不是Windows NT的cmd.exe。例如它doesn't support exit /B
或copy /B
等。同样,它只是doesn't have set /P
, set /A
or set "with=quote"
和支持
SET [variable=[string]]
我还找到了另一份Script Commands for Windows Mobile Devices的详细清单。在此列表中,if
command声称只有以下形式
if [not] errorlevel number scriptCommand
if [not] string1==string2 command
if [not] exist filename command
if [not] procexists processName command
这个列表中没有if defined
。然而,document on MSDN不同意,因为它没有列出奇怪的procexists
形式,但IF [NOT] DEFINED variable command
一个
尽管如此,两人都同意if
不能有else
,因此你的if / else块也不起作用。即使它有if defined
,你脚本中的最后一行也行不通,因为你使用的是在WinCE中没有的start ""
。你必须使用START command [parameters]
if/else
,set /P
和start ""
(可能还有if defined
)的问题Windows CE命令shell并不像它的NT兄弟那样强大。 CE不支持Set / P.
自v5以来shell没有改变。 (https://en.wikipedia.org/wiki/Windows_Embedded_Compact)
以下是v5支持的命令及其参数的列表。 http://nellisks.com/ref/dos/ce/SET.html
如果您确实需要使用shell解决此问题,则可以使用其他语言轻松编写此行为代码。
祝好运。