普通网友 2015-07-16 16:08
浏览 47
已采纳

.Batch文件不喜欢php可执行文件的变量

I have a batch file which is going to be called by Windows Task Scheduler to execute given .php file.

However there seems to be a problem because when I provide full path to php.exe i.e.

start /B /wait C:\xampp\php\php.exe -f %inputTask% >> %outputDir%

batch file executes as it should, but when I try to give variable like so:

set php="C:\xampp\php"
start /B /wait C:\xampp\php\php.exe -f %inputTask% >> %outputDir%

if fails given the following error :

Windows cannot find '-f'. Make sure you type the name correctly, and then try again.

  • 写回答

1条回答 默认 最新

  • douyou8047 2015-07-16 17:37
    关注

    Start command considers the first double-quoted parameter to be a window title...

    START: Start a program, command or batch script (opens in a new window.)

    Syntax

      START "title" [/D path] [options] "command" [parameters]
    

    Always include a TITLE this can be a simple string like "My Script" or just a pair of empty quotes "". According to the Microsoft documentation, the title is optional, but depending on the other options chosen you can have problems if it is omitted.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 蓝桥oj3931,请问我错在哪里
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染