Using the code below I would like to move these files to the Program Files directory. If I try the code below I get this error. How can you request admin privileges like other programs do?
import os
import glob
import shutil
files = glob.glob("Files/*")
for f in files:
shutil.copy(f, "C:/Program Files/Project/Output/")
The Error:
PermissionError: [Errno 13] Permission denied: 'C:/Program Files/Projects/Output\\Output.txt'
I am using Python 3.8.5
I found the solution
When converting the .py
file to an .exe
file with PyInstaller
, use the option
-uac=admin
Thanks to @mogi