Read key from Windows registry

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
rebr
Posts: 41
Joined: 17 Nov 2013 20:30

Read key from Windows registry

Post by rebr »

Is there anyway to get the value at Windows Registry by SC?

I want to get:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\{374DE290-123F-4565-9164-39C4925E467B}


Thanks in advance. :tup:

ds1508
Posts: 17
Joined: 19 Jul 2016 12:51
Location: NRW, Germany

Re: Read key from Windows registry

Post by ds1508 »

You could use runret with a batch.
Pls have a look at http://stackoverflow.com/questions/4451 ... tch-script
In special cases you may contact me on Discord: http://bit.ly/dsDisco

highend
Posts: 14658
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Read key from Windows registry

Post by highend »

Probably the shortest version (only tested on a german system):

Code: Select all

    $k = quote("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders");
    $v = quote("{374DE290-123F-4565-9164-39C4925E467B}");

    $result = formatlist(gettoken(runret("REG QUERY $k /v $v"), 4, "    "), "e", <crlf>);
    text $result;
Put a question mark in front of "$result = ..." if you don't get the expected output to see what's going on...
One of my scripts helped you out? Please donate via Paypal

rebr
Posts: 41
Joined: 17 Nov 2013 20:30

Re: Read key from Windows registry

Post by rebr »

highend wrote:Probably the shortest version (only tested on a german system):

Code: Select all

    $k = quote("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders");
    $v = quote("{374DE290-123F-4565-9164-39C4925E467B}");

    $result = formatlist(gettoken(runret("REG QUERY $k /v $v"), 4, "    "), "e", <crlf>);
    text $result;
Put a question mark in front of "$result = ..." if you don't get the expected output to see what's going on...
You genius! Worked awesome. Thanks a lot!

rebr
Posts: 41
Joined: 17 Nov 2013 20:30

Re: Read key from Windows registry

Post by rebr »

ds1508 wrote:You could use runret with a batch.
Pls have a look at http://stackoverflow.com/questions/4451 ... tch-script
Thanks for the north! :tup:

Post Reply