无法为包含 .py 文件的批处理文件进行任务调度以在 Windows 10 中启动

用户10358702

我有以下批处理文件

SET logfile="C:\Reports\logbatch.log"
@echo off
@echo Starting Script at %date% %time% >> %logfile%
"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe" 
"C:\Users\mypc\source\repos\WebS\WebS\Start_Master.py"
@echo finished at %date% %time% >> %logfile%
pause

Start_Master.py包含位于与Start_Master.py同一文件夹中其他几个脚本

如果我手动运行它,批处理文件有效。

当我创建任务并且任务自动或手动运行时,我发现它无法打开文件

python: can't open the file 'script1.py' No such file or directory
python: can't open the file 'script2.py' No such file or directory
python: can't open the file 'script3.py' No such file or directory
血管瘤

尝试:

SET logfile="C:\Reports\logbatch.log"
@echo off
@echo Starting Script at %date% %time% >> %logfile%
cd "C:\Users\mypc\source\repos\WebS\WebS\"
"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe" 
"C:\Users\mypc\source\repos\WebS\WebS\Start_Master.py"
@echo finished at %date% %time% >> %logfile%
pause

尝试将CWD(当前工作目录)更改为Start_Master.py所在的目录

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

批处理文件在Windows 10中无法正确运行

在python中为Maya(Windows 10)运行批处理文件时,无法识别Imagemagick

为什么我无法在Windows 10中运行的jenkins管道中运行批处理文件?

Windows 10中批处理文件中的%1无法恢复

Windows 10中无法将'java'识别为内部或外部命令,可操作程序或批处理文件

在Windows 10中双击运行.py文件

这个批处理文件会损坏/阻止 Windows 10 启动吗?

使用批处理文件创建并启动Windows 7或10服务?

通过脚本或批处理文件从Windows 10中的任务栏中取消固定文件资源管理器

在Windows 10下批处理文件中获取目录或文件简称的问题

如何使用批处理文件在 Windows 10 中删除具有特定名称的文件?

Windows批处理文件中文件名中包含非ASCII字符的文件

批处理文件:检查操作系统是否为Windows 10

可以从无法启动的 Windows 10 中恢复文件吗?

如何在Windows 10中的批处理文件中从%〜dp0末尾删除空间

在Windows 7中批处理文件以将重要文件存档为zip文件

批处理文件在Windows 10升级中不起作用

仅保留 txt 文件中包含某个单词/字符的行(Powershell)(Windows 批处理文件)

当嵌套在 if 语句中时,启动 cmd 无法在 Windows 批处理文件中正确执行

从Windows的批处理文件中删除特定文件夹(如果为空)?

我无法在Windows 10上的cmd或Kali linux的终端中运行.py文件

是否可以从批处理文件中获取运行批处理文件的任务调度程序任务的名称?

在Windows 10 UWP中从路径启动文件

为什么Windows批处理文件中的换行符导致无法识别括号?

如何测试gcc是否无法在Windows批处理文件(cmd)中编译程序?

在Windows 10中的Task Scheduler上计划.py文件

Apache无法在Windows 10中启动

无法从Windows 10中的Eclipse启动GenyMotion

从批处理文件的powershell.exe调用升级到Windows 10后无法忍受的缓慢