批处理文件手动运行,但不通过 Windows 10 任务计划程序 [英] Batch file runs manually but not through Windows 10 Task Scheduler

查看:31
本文介绍了批处理文件手动运行,但不通过 Windows 10 任务计划程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在从任务计划程序运行 .bat 文件方面我真的需要帮助.

I really need help on running a .bat file from the Task Scheduler.

它在从位置运行或从任务计划程序中单击 Run 时运行.

It runs when ran from location or when Run is clicked from Task Scheduler.

仅在用户登录时运行/在用户登录时运行时不按计划运行

用户是我的本地帐户也是管理员

The user is my local account is also the admin

.bat文件存放在C:Usersuser1eclipse-workspaceabc中,这是我为填写的Actions 标签中 Settings 下的 Program/Script.

.bat file is stored in C:Usersuser1eclipse-workspaceabc, and this is what iI have filled in for the Program/Script under Settings in Actions tab.

我已取消选中 Conditions 选项卡下的所有选项,(尝试检查 power 选项,仍然不起作用).

I have unchecked all options under Conditions tab, (tried checking the power options, still didnt work).

我希望设置此选项 :: 在用户登录或未登录时运行.

I would prefer to have this option set :: Run when user is logged on or not.

我想知道我错过了什么或者我哪里出了问题.

I would like to know what I'm missing or where I'm going wrong with this.

.bat 文件代码为:

.bat file code is :

cd C:Usersuser1eclipse-workspaceabc
set ProjectPath=C:Usersuser1eclipse-workspaceabc
echo %ProjectPath%
set classpath=%ProjectPath%in;%ProjectPath%Lib*
echo %classpath%
java org.testng.TestNG %ProjectPath%	estng.xml
pause

推荐答案

这个救了我:

  • 确保在您的任务计划程序设置中关闭以最高权限运行"
  • 在你的 bat 文件中,使用 pushd \network_drive_name 作为第一行代码
  • 在您的 bat 文件末尾,使用 popd \network_drive_name
  • Make sure "Run with highest privileges" is turned off in your task scheduler settings
  • In your bat file, use pushd \network_drive_name as the first line of code
  • At the end of your bat file, use popd \network_drive_name

这篇关于批处理文件手动运行,但不通过 Windows 10 任务计划程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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