Closed aaslam-1945 closed 4 years ago
The issue you have here is the backslash, when used in a python string it's used as a string escape character, e.g. \n
is a newline, \t
is a table, etc.
You have 2 ways of getting around this
"HKLM:\\SOFTWARE"
r
in front of the string to stop the escaping behaviour, r"HKLM:\SOFTWARE"
Considering reg is it's own executable you can also bypass calling it from cmd.exe like so
stdout, stderr, rc = conn.run_executable("reg.exe", arguments='add "HKLM:\\SOFTWARE" /v hsg')
If you are still having trouble please post the stdout, and stderr that you are getting back.
Closing as per the above.
Hi Jordan,
In my use case i want to edit, add or delete registry values on a remote Windows 10 machine using your wonderful package. Here is my syntax but its not working.
stdout, stderr, rc = conn.run_executable("cmd.exe",arguments='/c reg add "HKLM:\SOFTWARE" /v hsg')
or
Something like this New-Item -Path "HKLM:\SOFTWARE" -Name "hsg" in Powershell.exe
or using a .reg file
stdout, stderr, rc = conn.run_executable("regedit.exe",arguments='/s "/localhost location/regFile.reg"')
Any help in this regard would be highly appreciated.