Can't Run Excel From A Cron Job Under Windows 7
Tue Nov 18 22:49:00 GMT 2014
On Nov 12, 2014, at 9:20 AM, Kertz, Denis (D)** CTR ** <firstname.lastname@example.org> wrote:
>> More like you expect to run Excel interactively from service.
>> Not possible. Period.
> I'm not trying to run Excel interactively from a cron job. One of the limitations with using Excel from a cron job is Excel has to run error free.
That’s not the key issue here.
Windows does not allow a service to have a GUI, at all. Unless Excel is smart enough to not even start its GUI loop when it sees that it is running as a service — as it will be when running under “cron as service” — it will fail.
You were offered a choice when running cron-config: to run as a service or not. If you installed it as a service, try removing the Cygwin cron service and reinstalling it to run under your user account. I tested it here, and a Bash script was able to launch notepad.exe via cron when run this way.
(I did not test the run-as-service case since I haven’t changed my user permissions per on my test VM, and I don’t want to. And per above, I do not think it would succeed anyway.)
This means you will have to leave that computer logged in all the time. You also need to ensure that /usr/sbin/cron.exe starts on each login. As soon as you log out — and possibly if the desktop gets locked — cron will go back to failing to run GUI programs.
If this also fails, try using the Windows Task Scheduler instead. It’s more suited to this sort of task.
For that matter, why bring Cygwin into this at all? You’re clearly already familiar with VBScript, so why not create a VB app to do all the CreateObject() stuff?
If your excuse is that you don’t have Visual Studio, then you have no excuse, since there is a free version that will suffice for such a simple task.
 cygrunsrv -R cron
 Beware, VSE will go away eventually: http://goo.gl/Cjmq2q
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin