14

I want to launch cmd.exe to execute command using Task Scheduler :

Here is my command line :

C:\wamp\bin\php\php5.5.12\php.exe -f "C:\Inetpub\wwwroot\php\index.php"

This command will load a php.exe and run my php script from C:\Inetpub\wwwroot\php

Here is how I set up my task scheduler :

enter image description here

I am not sure - what to put in the Start in Box - plus since it's (optional) so I leave it blank.

After save the task and hit run, I got this

enter image description here

It doesn't do anything.

What did I do wrong - here ?

1 Answers1

18

Program should not be cmd but C:\wamp\bin\php\php5.5.12\php.exe and the argument should be -f "C:\Inetpub\wwwroot\php\index.php". You can leave Start in blank. It refers to "current folder" from the program's perspective. It should not really matter in you current scenario.

Klaus Byskov Pedersen
  • 117,245
  • 29
  • 183
  • 222
  • Ohh I see what you mean, but if I want to stick in my way, there is no way - it will work right ! I'm just curious - your suggestion is 100% working. –  Feb 13 '15 at 20:01
  • 7
    Sure, it would be `cmd.exe` in program, but then arguments would be: `/C "C:\wamp\bin\php\php5.5.12\php.exe -f C:\Inetpub\wwwroot\php\index.php"`. – Klaus Byskov Pedersen Feb 13 '15 at 20:07
  • 2
    It's an argument switch for `cmd`. Type `help cmd` in a command prompt to see the arguments that you can use with `cmd.exe`. – Klaus Byskov Pedersen Feb 13 '15 at 20:36