Search code examples
pythonwindowspasswordsrunas

Pass Password to runas from Python


I need to run a file as another user without it prompting for a password, from my script. How is this done?


Solution

  • There's an executable program called SANUR.EXE that's made for just this kind of situation: you can use it to pipe in the password on the command-line, like this: runas /user:domain\username cmd.exe | sanur mysekritpassword.