0

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
  • start /B /wait "C:\xampp\php\php.exe -f %inputTask%" >> %outputDir% Commented Jul 16, 2015 at 16:29

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes that has solved the problem :) - adding empty quotes was sufficient

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.