Quando provo a leggere un valore da questa chiave, il valore corretto di questa chiave non viene restituito, ma invece ho un valore di percorso di una chiave diversa?Python _winreg keypath errato
import _winreg as wreg
key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
print(wreg.EnumValue(key, 0))
E l'output:
('SunJavaUpdateSched', u'"C:\\Program Files (x86)\\Common Files\\Java\\Java Update\\jusched.exe"', 1)
Ma questo valore non è parte della chiave che ho usato? Questo valore non si trova in questa chiave che dovrei avere un valore diverso. Ho cercato di dove il valore si trova il valore corretto di RegEdit e si trova a
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
Quando uso del prompt dei comandi
REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
E ho l'uscita corretta ...
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
IgfxTray REG_SZ "C:\Windows\system32\igfxtray.exe"
HotKeysCmds REG_SZ "C:\Windows\system32\hkcmd.exe"
Persistence REG_SZ "C:\Windows\system32\igfxpers.exe"
Poi vorrei provare a utilizzare os.popen su python ...
import os
buff = os.popen("REG QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
print(buff.read())
E l'uscita
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
SunJavaUpdateSched REG_SZ "C:\Program Files (x86)\Common Files\Java\Java Update\jusched.exe"
Perché questi diverso? Come posso ottenere il valore corretto usando _winreg
?
probabilmente ha qualcosa a che fare con [Visualizzazioni Registro Alternate] (https://msdn.microsoft.com/en-us/library/aa384129%28v=VS.85%29.aspx) perché sei esecuzione di Python a 32 bit su una versione a 64 bit del sistema operativo. Questo è menzionato nella '_winreg' [documentazione] (https://docs.python.org/2/library/_winreg.html#bit-specific). – martineau
Come hai impostato il valore? – vks
@vks Questi valori chiave sono auto-installati, voglio solo recuperarli. – user3818650