我的脚本不会在任务调度程序下运行.为什么? [英] My script won't run under the task scheduler. Why?

查看:61
本文介绍了我的脚本不会在任务调度程序下运行.为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 vbscript 脚本,当我自己运行它时运行良好.

I have a vbscript script that I runs fine when I am running it myself.

出于某种原因,当我以管理用户身份在任务调度程序下运行它时,它会运行,但甚至不会写入我的日志文件.它不应该是权限,因为我运行它的用户是管理员.

For some reason, when I run it under the task scheduler as an administration user, it runs, but doesn't even write to my log file. It shouldn't be permissions, as the user I run it under is adminstrator.

它是在 Win2008 64 位机器上调用 32 位 dll 的脚本.

Its a script calling 32 bit dlls on a Win2008 64 bit machine.

C:\windows\SysWOW64\cscript.exe Bob.vbs

C:\windows\SysWOW64\cscript.exe Bob.vbs

我还将本地目录设置为我运行它的位置.

I also set the local directory to where I run it from.

具有讽刺意味的是,任务调度程序说成功完成"了运行任务.

Ironically the task scheduler says that "successfully finishes" running the task.

此外,任务调度器中还有其他脚本运行良好,只是这个脚本.

Also, there are other scripts in the task scheduler running fine, its just this script.

有人有我可以检查的清单吗?

Does anyone have a list of things that I can check?

推荐答案

我在 SVN 服务器上运行计划任务时遇到了类似的问题.

I had a similar problem running a scheduled task on my SVN server.

我的脚本正在写入我认为是当前工作目录(我为任务指定为开始于"文件夹的目录).如果我登录到服务器并运行脚本,它运行良好.当作为预定作业运行时,它不会.

My script was writing to what I thought was the current working directory (the directory I specified for the task as the "Start in" folder). If I logged onto the server and ran the script it worked fine. When running as a scheduled job it wouldn't.

在我的例子中,看起来调度程序将工作目录重新分配为用于运行作业的用户帐户的 TEMP 环境变量中指定的目录,而不是我指定的目录用于任务(开始于"文件夹).

In my case, it looked like the scheduler re-assigned the working directory to be the directory specified in the TEMP environment variable for the user account used to run the job, not the directory I specified for the task (the "Start in" folder).

检查帐户的 TEMP 文件夹,看看您的文件是否在那里.

Check the TEMP folder for the account and see if your files are there.

这篇关于我的脚本不会在任务调度程序下运行.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆