1
votes

I am running a .bat file from windows task scheduler every hour, the file is named: followers.bat

And contains:

@ECHO OFF
C:\xampp\php\php.exe -f "C:\xampp\htdocs\Test\FollowTrackerV2\followers.php"

It is entered in the task scheduler like so:

program / script: C:\xampp\htdocs\Test\FollowTrackerV2\followers.bat

parameters (optional): <blank>

Start in (optional): C:\xampp\htdocs\Test\FollowTrackerV2

I tried adding parameter /min but that did not seem to work, it flashed a command prompt like it always does.

I searched around but I did not find a concrete answer, I hope right now in 2015 on windows 8.1 there is a clever / easier way to do this, but I am not aware of that. Hence why I am asking you guys :)

Thanks!

2
Have a look at this. Especially the second answer. superuser.com/questions/198525/…Jonathan Kuhn

2 Answers

2
votes

You can write a simple VBScript to call the batch file and then use the scheduled task to run the VBScript.

CreateObject("Wscript.Shell").Run "batch-file.bat", 0, True
0
votes

Your question isn't clear, but the code I use to work with windows command line in hidden mode is:

<?php
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("cmd /C C:\xampp\htdocs\Test\FollowTrackerV2\followers.bat", 0); // 0 invisible / 1 visible

Note:

Make sure Apache is running under the same user as you, otherwise it won't work.

To run the apache as the same user as you, first Stop the Apache service and go to, in my case, C:\wamp\bin\apache\apache2.4.9\bin, open a command prompt there and type httpd, now run the code above.