Python subprocess.Popen as different user on Windows

Eric Pruitt picture Eric Pruitt · Nov 25, 2010 · Viewed 9.2k times · Source

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.

Answer

DaveP picture DaveP · Nov 25, 2010

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.