繁体   English   中英

Python:无法使用Python脚本打开新的命令提示符会话并通过命令行(Windows)运行程序

[英]Python: Unable to open a new command prompt session and run a program through command line (windows) using Python script

我的Python脚本在一个cmd会话中运行,我想打开一个新的cmd会话并运行以下文件-

C:\\ Users \\ nilabja.saha \\ AppData \\ Local \\ UiPath \\ app-19.10.1 \\ UiRobot.exe执行--file“ C:\\ Users \\ nilabja.saha \\ Documents \\ UiPath \\ TriggerXXX \\ Main.xaml”

[这是一个可以通过CMD触发的UiPath文件。

使用Python完全可以运行吗? 请帮忙。

使用子进程,我可以到达路径的末尾,但随后无法执行文件。(下面的代码)

subprocess.Popen('cmd.exe / K cd /Users/nilabja.saha/AppData/Local/UiPath/app-19.10.1')

请帮忙!

from telegram.ext import Updater
updater = Updater(token='tokentoken', use_context=True)
dispatcher = updater.dispatcher
import logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)

import subprocess
subprocess.call([r'C:\Users\UserName\AppData\Local\UiPath\UiPath.Agent']) 
def start(update, context):
   context.bot.send_message(chat_id=update.effective_chat.id, text="Start")

updater.start_polling()

#import os
def echo(update, context):
    #import subprocess
    context.bot.send_message(chat_id=update.effective_chat.id,  text=   'Processing...')
    file = context.bot.getFile(update.message.photo[-1].file_id)
    print ("file_id: " + str(update.message.photo[-1].file_id))
    #file.download(str(update.effective_chat.id) + '.jpg')
    file.download('C://Users//UserName//Documents//UiPath//PROJECT//' + str(update.effective_chat.id) + '.jpg')
    #from pywinauto.application import Application
    #from pywinauto.keyboard import SendKeys
    import win32com.client as comclt
    wsh = comclt.Dispatch("WScript.Shell")
    wsh.AppActivate("UiPath.Agent") 
    wsh.SendKeys("^t") 

from telegram.ext import MessageHandler, Filters
echo_handler = MessageHandler(Filters.photo, echo)
dispatcher.add_handler(echo_handler)

def echoText(update, context):
    context.bot.send_message(chat_id=update.effective_chat.id, text='TalK')

from telegram.ext import MessageHandler, Filters
echo_handler = MessageHandler(Filters.text, echoText)
dispatcher.add_handler(echo_handler) </code> 

这是RunBat.bat的示例-启动一个Python服务器,如果发现聊天图片,它将侦听chatbot香奈儿,并在orchestrator中启动UIPath bot

e

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM