注意:
注意:
任务计划程序设置:(弹性搜索已在运行,我想运行A.py)
程序脚本:
cmd
参数:
/c sche.cmd > yash.txt
开始于:
D:\path\
sche.cmd包含:
@echo on
cmd /k "cd /d D:\path\env\Scripts\ & activate & pythonw.exe & cd /d D:\path\files & python A.py"
现在,
注意:路径中存在缺口:'\11.11.11\d$\E*ELE in A5*\S\A',但限制是我无法更改路径,因为这是生产路径
注意:在用户登录或未登录且启用最高权限时运行
A.py是:
from elasticsearch import Elasticsearch
import os, glob
import datetime as dt
from datetime import datetime
from dateutil import parser
ES_HOST = {"host": "localhost", "port": 9250}
es = Elasticsearch(hosts=[ES_HOST])
n = 0
a=b=c=d=0
ip = '11.11.11.11'
username = 'abcdefgh'
password = '12345678'
use_dict = {}
use_dict['remote'] = ('\\11.11.11.11\d$\E\ELE In A5\S\A')
use_dict['password'] = ('12345678')
use_dict['username'] = ('abcdefgh')
folder_path = r'\\11.11.11.11\d$\E\ELE In A5\S\A'
print("############", folder_path)
dirContents = os.listdir(r'\\11.11.11.11\d$\E\ELE In A5\S\A')
print("yahoo")
if len(dirContents) == 0:
print('Folder is Empty')
n = 0
else:
print('Folder is Not Empty')
for filename in glob.glob(os.path.join(folder_path, '*')):
with open(filename, 'r', encoding="ISO-8859-1") as f:
text = f.read()
{DO SOMETHING}
**更多细节已在未回答的问题中: **Running python script in Service account by using windows task scheduler****
目前没有回答
相关问题 更多 >
编程相关推荐