You could use the build in module winreg for this.
Then get the downloads folder from the registry which is
{374DE290-123F-4565-9164-39C4925E467B}
The full code would look like this:
import winreg
import os
reg_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
downloads_path = winreg.QueryValueEx(reg_key, "{374DE290-123F-4565-9164-39C4925E467B}")[0]
winreg.CloseKey(reg_key)
print(downloads_path)
This will work on Windows 7 and later.
Answer from Datertec on Stack OverflowHow to find the path to the "Downloads" folder using Python on Windows 10/11? - Stack Overflow
How can I find where Python is installed on Windows? - Stack Overflow
directory - python - Finding the user's "Downloads" folder - Stack Overflow
How can I find the path to the "Downloads" folder using Python on any version of Windows?
You could use the build in module winreg for this.
Then get the downloads folder from the registry which is
{374DE290-123F-4565-9164-39C4925E467B}
The full code would look like this:
import winreg
import os
reg_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
downloads_path = winreg.QueryValueEx(reg_key, "{374DE290-123F-4565-9164-39C4925E467B}")[0]
winreg.CloseKey(reg_key)
print(downloads_path)
This will work on Windows 7 and later.
To obtain the full path to the downloads folder on any version of Windows, you can use the command "shell: Downloads" which will lead you to the folder. From there, you can take the parent directory of the resulting path, which will provide you with the complete and accurate path to the downloads folder, regardless of the language used in the operating system.
In your Python interpreter, type the following commands:
>>> import os, sys
>>> os.path.dirname(sys.executable)
'C:\\Python25'
Also, you can club all these and use a single line command. Open cmd and enter following command
python -c "import os, sys; print(os.path.dirname(sys.executable))"
If you have Python in your environment variable then you can use the following command in cmd or powershell:
where python
or for Unix enviroment
which python
command line image :

from pathlib import Path
downloads_path = str(Path.home() / "Downloads")
This fairly simple solution (expanded from this reddit post) worked for me
import os
def get_download_path():
"""Returns the default downloads path for linux or windows"""
if os.name == 'nt':
import winreg
sub_key = r'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
downloads_guid = '{374DE290-123F-4565-9164-39C4925E467B}'
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, sub_key) as key:
location = winreg.QueryValueEx(key, downloads_guid)[0]
return location
else:
return os.path.join(os.path.expanduser('~'), 'downloads')
- The GUID can be obtained from Microsoft's
KNOWNFOLDERIDdocs - This can be expanded to work more generically other directories
For Windows 10/8/7:
- Open
System Properties(Right clickComputerin the start menu, or use the keyboard shortcut Win+Pause) - Click
Advanced system settingsin the sidebar. - Click
Environment Variables... - Select
PATHin theSystem variablessection - Click
Edit Add Python's path to the end of the list (the paths are separated by semicolons). For example:
C:\Windows;C:\Windows\System32;C:\Python27
For Windows XP:
- Open
System Properties(Type it in the start menu, or use the keyboard shortcut Win+Pause) - Switch to the
Advancedtab - Click
Environment Variables... - Select
PATHin theSystem variablessection - Click
Edit Add Python's path to the end of the list (the paths are separated by semicolons). For example:
C:\Windows;C:\Windows\System32;C:\Python27Test on a new terminal window or if using an integrated terminal within a text editor, close and restart your editor or the changes won't be applied.
For anyone trying to achieve this with Python 3.3+, the Windows installer now includes an option to add python.exe to the system search path. Read more in the docs.
Hey everyone,
I'm working on a Python project where I need to access the user's "Downloads" folder. However, I'm having trouble finding a reliable way to get the path to this folder that works on any version of Windows (10/11).
I've tried using the os.path.expanduser()function and the USERPROFILEenvironment variable, but it seems like the path to the "Downloads" folder can vary depending on the language version of Windows.
Does anyone know of a way to find the path to the "Downloads" folder that works on any version of Windows using Python?
Thanks in advance!
Edit: StackOverflow suggested a working solution: https://stackoverflow.com/questions/75807152/how-to-find-the-path-to-the-downloads-folder-using-python-on-windows-10-11
Edit2: Since the SO moderators have marked my question as a duplicate of a question that asks about something completely different, I'm afraid it will be deleted. I am posting here a snippet of the code that worked in my case
import winreg
reg_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
downloads_path = winreg.QueryValueEx(reg_key, "{374DE290-123F-4565-9164-39C4925E467B}")[0] winreg.CloseKey(reg_key)
print(downloads_path)