Questions tagged [winreg]

_winreg is the python module for Windows registry access. This module provides a low-level interface to the Windows registry database. The interface directly mirrors the underlying Windows API.

_winreg (renamed to winreg in Python 3) is the python module for Windows registry access. The functions in this module expose the Windows registry API to Python. Rather than using an integer as the registry handle, a handle object is used to ensure that the handles are closed correctly, even if the programmer neglects to explicitly close them.

For a complete reference, please see the python documentation at docs.python.org.

160 questions
2
votes
0 answers

Deleting subkeys under a key

I want to be able to delete all the subkeys under a key but I keep getting the error [WinError 2] The system cannot find the file specified Here is the code I used from another answer (python: how to delete registry key (and subkeys) from HKLM…
Lee Yerin
  • 37
  • 4
2
votes
1 answer

How to make Python's winreg see entries in the registry that are visible in the Registry Editor for Adobe CC programs?

I am trying to use the winreg library of python to access the registry keys for Adobe products (Photoshop, After Effects, Ect.), and while i can see the HKEY_LOCAL_MACHINE subkeys in the Registry Editor, Python can't seem to see the same keys. Is…
2
votes
0 answers

Get installation path of a software(Acrobat Reader) using winreg

I need to find the installation path of Acrobat Reader installed in the client system like C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe I'm getting the following using wingreg from winreg import OpenKey, HKEY_LOCAL_MACHINE,…
Jisson
  • 3,566
  • 8
  • 38
  • 71
2
votes
1 answer

properly decipher registry REG_BINARY with python 3 winreg?

trying to read the information of the subkey Render in the key "Computer\HKEY_USERS\S-1-5-19\Software\Microsoft\Windows\CurrentVersion\Audio\Journal". windows makes changes to that registry REG_BINARY entry when switching audio output devices. i've…
theoka
  • 53
  • 9
2
votes
1 answer

Python 3 winreg: unable to write to the Windows registry

Trying to write a value to HKLM hive by the path provided below. Code silently completes without errors or exceptions, however, value remains the same. The script is executed under Administrator, without it AccessDenied (5) Windows error is thrown…
user707779
2
votes
1 answer

How to get the list of installed applications on Windows 10 from Java

I'm trying to get a list of all applications installed in windows 10 from my Java program. I have tried the following: Runtime.getRuntime().exec("Get-WmiObject -class Win32_Product | Select-Object -Property Name"); and I get: Cannot run program…
Javier V. R.
  • 23
  • 1
  • 5
2
votes
1 answer

Winreg Python, QueryInfoKey giving incorrect date/times for the last changed?

I have a function that loops through a list containing found registry key paths. I now need to find the date each registry key was last changed from that list of keys. def get_values(subkeylist): try: x = 0 nanos = [] while x <…
Mr.Pixel
  • 43
  • 5
2
votes
0 answers

Creating registry keys not working, no errors

I'm trying to emulate the following registry script in python. Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\Open with notepad] [HKEY_CLASSES_ROOT\*\shell\Open with notepad\command] @="notepad %1" My attempt looks like…
chtenb
  • 14,924
  • 14
  • 78
  • 116
2
votes
4 answers

Unable to import _winreg in Python 2.7.9 virtual environment

I'm running an app engine application in a virtual environment on windows 7 64bit, python 2.7.9 x64. Here's the stacktrace: p_system = platform.system() File "C:\Python27\lib\platform.py", line 1310, in system return uname()[0] File…
Filip Haglund
  • 13,919
  • 13
  • 64
  • 113
2
votes
1 answer

Disable registry redirection to Wow6432Node in Python

I'm trying to access registry keys under HKEY_LOCAL_MAHINE\SOFTWARE... on a 64 bits system. I have following code but judging by the results it gets redirected to Wow6432Node even though I have…
Onedot618
  • 273
  • 2
  • 13
2
votes
1 answer

Registry change through python working incorrectly

import _winreg as registry key=registry.OpenKey(registry.HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Internet Settings",0,registry.KEY_ALL_ACCESS) proxy=proxy_server+":"+proxy_port registry.SetValue(key, 'ProxyEnable',…
vks
  • 67,027
  • 10
  • 91
  • 124
2
votes
1 answer

python: _winreg problem

the windows registry may contain keys whose names with embedded nulls when i call _winreg.OpenKey(key, subkey_string_with_embbeded_null) i get the following error: TypeError: OpenKey() argument 2 must be string without null bytes or None, not…
bandana
  • 3,422
  • 6
  • 26
  • 30
2
votes
2 answers

Python 2.6 - I can not write dwords greater than 0x7fffffff into registry using _winreg.SetValueEx()

using regedit.exe I have manually created a key in registry called HKEY_CURRENT_USER/00_Just_a_Test_Key and created two dword values dword_test_1 and dword_test_2 I am trying to write some values into those two keys using following program import…
user286431
  • 31
  • 5
2
votes
1 answer

Python: Look into the registry to find install location of a program

I am trying to find the install location of a programme using the windows registry. I have managed to find the key and the value that I need. They are found in the Software\Microsoft\Windows\CurrentVersion\Uninstall folder. However when I run the…
Marmstrong
  • 1,686
  • 7
  • 30
  • 54
2
votes
1 answer

How write local time (REG_BINARY) to registry with _winreg Python

How should I deal with value? def add(): ts = "Software\\Test\\ti" try: key = _winreg.CreateKeyEx(_winreg.HKEY_CURRENT_USER, ts, 0, _winreg.KEY_ALL_ACCESS) except: return False else: value =…
thinkerou
  • 1,781
  • 5
  • 17
  • 28
1 2
3
10 11