pyautogui
pywinauto是一組用於自動化Microsoft Windows GUI的python模塊。最簡單的是,它允許您將鼠標和鍵盤操作發送到Windows對話框和控件。
pyautogui官網文檔鏈接:
https://pywinauto.readthedocs.io/en/latest/remote_execution.html
1.在遠程的電腦上一個批處理文件,添加以下下代碼,
@%windir%\System32\tscon.exe 0 /dest:console
@%windir%\System32\tscon.exe 1 /dest:console
@%windir%\System32\tscon.exe 2 /dest:console
斷開遠程的時候不要直接斷開,運行上面的bat斷開。就會保持交互狀態
上面的腳本可能存在不穩定的情況,按照方式2
2.新建一個批處理文件,添加以下下代碼,斷開遠程的時候不要直接斷開,運行上面的bat斷開。就會保持交互狀態
for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
%windir%\System32\tscon.exe %%s /dest:console
)
3.遠程計算機上的屏幕分辨率必須與主計算機上的屏幕分辨率相同。設置參照以下鏈接
https://support.smartbear.com/testcomplete/docs/testing-with/running/via-rdp/smart-resizing.html