1
votes

Yesterday I asked you this question;

Running a batch file from windows task scheduler, but hidden or minimized

The answer I selected was one suggesting I'd make a VBScript and use that, to run the original .bat file that executed the php script.

However, a comment on that suggestion, suggested to remove the .bat entirely and just run the php from the VBScript. I decided that, that is what I wanted to do.

See here what I tried:

(This is written in followers.vbs)

CreateObject("Wscript.Shell").Run "C:\xampp\php\php.exe -f 'C:\xampp\htdocs\Test\FollowTrackerV2\followers.php'", 0, True

What I have entered in task scheduler:

Program / script: C:\xampp\htdocs\Test\FollowTrackerV2\followers.vbs

Parameters: <blank>

Start in: C:\xampp\htdocs\Test\FollowTrackerV2

When I execute the .vbs through task scheduler, it does not do anything visually and I am assuming it is not doing anything non-visible either since the php script is not being executed. (the php sends me an email, and I am not receiving any)

The php script works fine executing it from a .bat file so it must be in my VBScript.

If anyone could take a quick look and see if I am doing anything wrong, that'd be great.

Thanks!

2

2 Answers

2
votes

Main change here is the file path without quotes.

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "C:\xampp\php\php.exe -f C:\xampp\htdocs\Test\FollowTrackerV2\followers.php", 0
0
votes

It sounds like a permission issue with the scheduled task, try setting the scheduled task to run as an administrator user.