python - Auto input typekeys to cmd process that has admin privileges - Using pywinauto

扶醉桌前 提交于 2019-12-13 02:49:08

问题


I have a cmd process running with admin rights. I need to be able to automate some commands. Example echo Testing

MUST connect to existing Admin cmd process. (The cmd must be launched from here Location: C:\windows\system32\ComputerDefaults.exe).

Currently i can connect to a cmd process with normal rights and send code.

from pywinauto import Application


app = Application().connect(process = 16364)
dlg = app.top_window_()
dlg.TypeKeys('hello world')

However i can not connect to my cmd with admin rights. The window flashes but no command is entered.

New to coding :) Any help would be awesome!

来源:https://stackoverflow.com/questions/56607694/python-auto-input-typekeys-to-cmd-process-that-has-admin-privileges-using-py

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!