0
import os

path = "C:\Program Files (x86)\Steam\Steam.exe"

os.startfile(path)

How can I run this in administrator mode?

AfterHover
  • 97
  • 2
  • 12

1 Answers1

0

With this now the path is executed in admin mode, no?

import os

path = "C:\Program Files (x86)\Steam\Steam.exe"

os.startfile(path, 'runas')
AfterHover
  • 97
  • 2
  • 12
  • If the user has no admin rights they will need to provide admin password. Check my second reference in my second comment – buran Jul 04 '22 at 13:28
  • Ok will keep that in mind thanks – AfterHover Jul 04 '22 at 13:32
  • Just to make it clear - I think your code with `os.startfile(path, 'runas')` will not work. that is why I said to check the link in the comment – buran Jul 04 '22 at 13:35