2011-12-30 39 views
0

我根據自己的需要修改了zf.bat文件的代碼,但它會生成此錯誤 「發生錯誤!操作」*「不是有效的操作「關於所有命令, 我該如何解決這個問題? 下面是批處理文件的代碼:Zend Framework - 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 [email protected] 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 [email protected] 
SET TMPZTMPZTMP=%ZTMPZTMPZTMPZ%[email protected] 
REM below @[email protected] 
FOR %%x IN ("@[email protected]") 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 [email protected][email protected] 
SET [email protected][email protected] 
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 [email protected] 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 [email protected] 
SET TMPZTMPZTMP=%ZTMPZTMPZTMPZ%[email protected] 
REM below @[email protected] 
FOR %%x IN ("@[email protected]") 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 [email protected][email protected] 
SET [email protected][email protected] 
GOTO RUN 

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

編輯的代碼:產生錯誤的快照通過一個命令 enter image description here

+0

如果有人可以解決,那麼我會感激他...... – Krishna 2011-12-30 14:22:12

+0

如果你還顯示了什麼原始.BAT文件看起來像,我__可以找出如何解決它。 – dbenham 2011-12-30 14:29:05

+0

咦? - 你說你修改了BAT文件。我需要知道你做了什麼改變。這就是爲什麼我要求您在進行更改之前提供一份文件副本。 – dbenham 2011-12-30 14:35:58

回答

0

更改這條線在你修改後的代碼:

SET PHP_DIR=%c:\xampp\php 

對此:

SET "PHP_DIR=c:\xampp\php" 

編輯 - 我只是意識到在你原來的修改額外%是越來越解析器反正剝離出來,因此上述建議不能幫助。


最後一行恢復到原來的形狀與最終%* - 這應該擴大到所有命令行參數。但它不適合你。要找出原因,請在恢復的最後一行之前立即添加新行ECHO ON

現在運行腳本,看看最後一行是如何解釋的。如果你無法弄清楚爲什麼它不起作用,請發佈結果。

+0

它不工作! – Krishna 2011-12-30 15:26:34

+0

我得到這個輸出:「php.exe」-d safe_mode =關-f「c:\ xampp \ php \ zf.php」 - *發生錯誤操作'*'不是有效的操作。 – Krishna 2011-12-30 17:15:08

+0

使用我的方法,即%1%2%3 ...而不是%*滿足了我在netbeans中創建zend項目樹形結構的需求。所以,現在沒有問題。 – Krishna 2011-12-30 17:36:00