We were using python 2 in our project and we had created various scripts that work on Windows 10 using pywin32 lib and were using import win32com.shell.shell as shell
and then execute the shell commands like shell.ShellExecuteEx(lpVerb='runas', lpFile='cmd.exe', lpParameters='/c ' + commands)
where commands is the command which we use to execute as admin prompt.
Our script needs to do some installation which we pass as command and recently due to executive decision we have to move to python3 and when I am trying to import import win32com.shell.shell as shell
it is not able to import it.
Can someone please suggest how can we execute shell command as admin in python 3.8.3 on Windows 10?
I know this is old but in case someone still have the same issue
you can use from win32comext.shell import shell
, as it's mentioned here on github.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With