Zend Framework - файл zf.bat генерирует ошибку командной строки - PullRequest
0 голосов
/ 30 декабря 2011

Я изменил код файла zf.bat в соответствии со своими потребностями, но он генерирует эту ошибку " Произошла ошибка! Действие '*' не является допустимым действием " вкл.все команды, как я мог решить это?Ниже приведен код пакетного файла:

@ECHO off
REM Zend Framework
REM
REM LICENSE
REM
REM This source file is subject to the new BSD license that is bundled
REM with this package in the file LICENSE.txt.
REM It is also available through the world-wide-web at this URL:
REM http://framework.zend.com/license/new-bsd
REM If you did not receive a copy of the license and are unable to
REM obtain it through the world-wide-web, please send an email
REM to license@zend.com so we can send you a copy immediately.
REM
REM Zend
REM Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
REM http://framework.zend.com/license/new-bsd     New BSD License


REM Test to see if this was installed via pear
SET ZTMPZTMPZTMPZ=@ph
SET TMPZTMPZTMP=%ZTMPZTMPZTMPZ%p_bin@
REM below @php_bin@
FOR %%x IN ("@php_bin@") DO (if %%x=="%TMPZTMPZTMP%" GOTO :NON_PEAR_INSTALLED)

GOTO PEAR_INSTALLED

:NON_PEAR_INSTALLED
REM Assume php.exe is executable, and that zf.php will reside in the
REM same file as this one
SET PHP_BIN=php.exe
SET PHP_DIR=%c:\xampp\php
GOTO RUN

:PEAR_INSTALLED
REM Assume this was installed via PEAR and use replacements php_bin & php_dir
SET PHP_BIN=@php_bin@
SET PHP_DIR=@php_dir@
GOTO RUN

:RUN
SET ZF_SCRIPT=%PHP_DIR%\zf.php
"%PHP_BIN%" -d safe_mode=Off -f "%ZF_SCRIPT%" -- %*

Я думаю, что ошибка в последнем символе последней строки.

РЕДАКТИРОВАТЬ: код исходного файла

@ECHO off
REM Zend Framework
REM
REM LICENSE
REM
REM This source file is subject to the new BSD license that is bundled
REM with this package in the file LICENSE.txt.
REM It is also available through the world-wide-web at this URL:
REM http://framework.zend.com/license/new-bsd
REM If you did not receive a copy of the license and are unable to
REM obtain it through the world-wide-web, please send an email
REM to license@zend.com so we can send you a copy immediately.
REM
REM Zend
REM Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
REM http://framework.zend.com/license/new-bsd     New BSD License


REM Test to see if this was installed via pear
SET ZTMPZTMPZTMPZ=@ph
SET TMPZTMPZTMP=%ZTMPZTMPZTMPZ%p_bin@
REM below @php_bin@
FOR %%x IN ("@php_bin@") DO (if %%x=="%TMPZTMPZTMP%" GOTO :NON_PEAR_INSTALLED)

GOTO PEAR_INSTALLED

:NON_PEAR_INSTALLED
REM Assume php.exe is executable, and that zf.php will reside in the
REM same file as this one
SET PHP_BIN=php.exe
SET PHP_DIR=%~dp0
GOTO RUN

:PEAR_INSTALLED
REM Assume this was installed via PEAR and use replacements php_bin & php_dir
SET PHP_BIN=@php_bin@
SET PHP_DIR=@php_dir@
GOTO RUN

:RUN
SET ZF_SCRIPT=%PHP_DIR%\zf.php
"%PHP_BIN%" -d safe_mode=Off -f "%ZF_SCRIPT%" -- %*

РЕДАКТИРОВАТЬ: Снимок сгенерированной ошибки одной командой enter image description here

1 Ответ

0 голосов
/ 30 декабря 2011

Измените эту строку в вашем измененном коде:

SET PHP_DIR=%c:\xampp\php

На это:

SET "PHP_DIR=c:\xampp\php"

Редактировать - я только что понял дополнительный% в вашей исходной модификацииВ любом случае парсер удаляет его, поэтому приведенное выше предложение не может помочь.


Восстановите последнюю строку в ее первоначальном виде с% * в конце - это должно раскрытьсяна все аргументы командной строки.Но это не работает для вас.Чтобы выяснить, почему, добавьте новую строку ECHO ON непосредственно перед восстановленной последней строкой.

Теперь запустите сценарий и посмотрите, как интерпретируется последняя строка.Если вы не можете понять, почему это не работает, опубликуйте результат.

...