dtvhqlc57127 2015-05-15 19:36
浏览 43

批处理文件作为计划任务与手动运行

I have a program I'm attempting to transfer over to a server to run with a scheduled task. It's using PHPExcel to essentially automate a schedule. In order to run it I created a batch file like I have for other reports I've done as scheduled tasks. That is simply with this code:

php C:\wamp\www\Folder\File.php
pause

Now when I run this as the batch file manually, everything works perfectly and there's no problems. If I run it through task scheduler whether manually or scheduled, it can't find the first of the parameter tables it needs to open to find pertinent information and ends there with this exception: Fatal error: Uncaught exception 'PHPExcel_Reader_Exception' with message 'Could not open ExcelFile.xlsx for reading! File does not exist.'

Some research has shown similar problems being caused by privileges, excel having problems with automation, the code from the batch file, and having the wrong path.

Privileges shouldn't be an issue because I'm running it from the domain administrator account, though I wonder if since it's a virtual machine that was just set up in a hurry perhaps there's something off. It just doesn't make sense for a user-level account to have more privileges than system level considering both are admin.

It's currently running with libreoffice, which I thought might be the issue except as previously mentioned it runs fine when manually running the batch file. And that throws the excel issues out.

Those other two issues were pretty easy to check, simply because it runs correctly one way, and if they were off it would never run correctly.

Are there any ideas why this would be occurring like this and how to fix it? How can it run fine manually on an admin user account, but not automatically as a system level task running with admin level privileges?

Thank you

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用
    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?