odd
odd

Reputation: 449

Can't find file when trying to open via command line.

I wonder if someone can help, I want to run a schedule task and I discovered that I can put a command line command in there, which is good.

What I need to happen is for a PHP file to run a bit like a cronjob.

The system I am using recommends I do the below but it's not working, now I believe it's due to the file being on E and not C, but I have no idea how to correct this, if anyone could give me some pointers that would be great.

"C:\Program Files (x86)\PHP\v5.3\php.exe E:\pathtofile\tasks\frequently.php -f"

System info is win 7

Upvotes: 0

Views: 1842

Answers (2)

Chibueze Opata
Chibueze Opata

Reputation: 10054

I believe what you want to know is how to schedule the php program to process a php file via command prompt (Note that the -f needs to come immediately after the php.exe:

schtasks /Create /tn MyJob /tr @"C:\Program Files (x86)\PHP\v5.3\php.exe -f E:\pathtofile\tasks\frequently.php" /sc onlogon

Upvotes: 1

Ken White
Ken White

Reputation: 125708

You've got your quote characters all fouled up, but there are separate entries for the various parts of the command in Task Scheduler.

Try this:

When creating the new task, set the Action: dropdown to Start a program.

In the Program/Script: entry, use

"C:\Program Files (x86)\PHP\v5.3\php.exe"

In the Add arguments (optional) entry use

"E:\pathtofile\tasks\frequently.php" -f

Upvotes: 1

Related Questions