Python subprocess.Popen 作为 Windows 上的不同用户 [英] Python subprocess.Popen as different user on Windows

查看:24
本文介绍了Python subprocess.Popen 作为 Windows 上的不同用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 上以不同用户身份在 Python 中启动子进程的最佳方式是什么?最好是 XP 及更高版本,但如果它只适用于 Vista 和 7,我也可以忍受.

What is the best manner of launching a subprocess as a different user in Python on Windows? Preferably XP and up, but if it works only on Vista and 7, I can live with that too.

推荐答案

我不确定你是否可以使用标准的 python 库来做到这一点.但是,pywin32 包有一个 win32process.CreateProcessAsUser 函数,这可能是您需要的.

I am not sure if you can do this with the standard python libraries. However, the pywin32 package has a win32process.CreateProcessAsUser function which may be what you need.

这篇关于Python subprocess.Popen 作为 Windows 上的不同用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆