# -*-coding:utf-8-*-
import os
import itchat
# 使用itchat和os 模块实现远程运行cmd命令,主要用于获取小型文件
@itchat.msg_register('Text')
def reponse(msg):
message = msg['Text']
toUser = msg['ToUserName']
print(toUser)
if toUser == 'filehelper':
if message[0:2] == 'cd':
os.chdir(message[3:])
itchat.send_msg("目录切换到" + os.getcwd(), 'filehelper')
else:
print(message)
f = os.popen(message, 'r')
reply_msg = f.read()
itchat.send_msg(reply_msg, 'filehelper')
itchat.auto_login()
itchat.send_msg('', toUserName='filehelper')
itchat.run()
Python实现的手机微信文件助手命令行控制
最新推荐文章于 2024-10-10 08:29:27 发布