[英]Powershell - converting hex from the registry key
I have the following output from an MRU list. 我从MRU列表中得到以下输出。 How can I convert it to String or ASCII characters?
如何将其转换为字符串或ASCII字符?
'gp "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU"' 'gp“HKCU:\\ Software \\ Microsoft \\ Windows \\ CurrentVersion \\ Explorer \\ ComDlg32 \\ LastVisitedPidlMRU”'
18 : {80, 0, 120, 0...} 18:{80,0,120,0 ...}
5 : {50, 0, 109, 0...} 5:{50,0,109,0 ...}
Assuming that gp "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU"
假设
gp "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU"
gives : 给出:
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRU
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32
PSChildName : LastVisitedPidlMRU
PSDrive : HKCU
PSProvider : Microsoft.PowerShell.Core\Registry
MRUListEx : {14, 0, 0, 0...}
11 : {114, 0, 117, 0...}
9 : {69, 0, 120, 0...}
19 : {83, 0, 107, 0...}
10 : {78, 0, 79, 0...}
17 : {123, 0, 57, 0...}
15 : {115, 0, 108, 0...}
7 : {123, 0, 57, 0...}
4 : {118, 0, 109, 0...}
21 : {109, 0, 115, 0...}
22 : {100, 0, 101, 0...}
24 : {123, 0, 55, 0...}
8 : {123, 0, 69, 0...}
0 : {123, 0, 69, 0...}
5 : {123, 0, 66, 0...}
12 : {83, 0, 110, 0...}
20 : {123, 0, 55, 0...}
23 : {83, 0, 99, 0...}
2 : {65, 0, 99, 0...}
16 : {110, 0, 111, 0...}
1 : {105, 0, 101, 0...}
18 : {75, 0, 105, 0...}
6 : {99, 0, 104, 0...}
13 : {123, 0, 55, 0...}
3 : {123, 0, 54, 0...}
14 : {123, 0, 57, 0...}
You can try: 你可以试试:
[System.Text.Encoding]::Unicode.GetString((gp "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRU")."11")
This not very good, but it can help 这不是很好,但它可以帮助
You can use the Get-RegistryKeyValue from the Carbon PowerShell module. 您可以使用Carbon PowerShell模块中的Get-RegistryKeyValue 。 It will return this key value as an array, which you can then decode:
它会将此键值作为数组返回,然后您可以解码:
$path = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRU'
$result = Get-RegistryKeyValue -Path $path -Name 0
[System.Text.Encoding]::Unicode.GetString( $result )
But it looks like that registry value contains more than just text. 但看起来注册表值不仅包含文本。
DISCLAIMER : I am the creator/maintainer of the Carbon module. 免责声明 :我是Carbon模块的创建者/维护者。
Using this tip from the Hey, Scripting Guy! 使用来自Hey,脚本专家的 提示 ! blog you could do something like this:
博客你可以做这样的事情:
$key = "HKCU:\Softw...dlMRU"
Get-Item $key | select -Expand property | % {
$value = (Get-ItemProperty -Path $key -Name $_).$_
[System.Text.Encoding]::Default.GetString($value)
}
Note that the values probably contain non-printable characters, so that alone won't suffice. 请注意,值可能包含不可打印的字符,因此仅此一项是不够的。 You'll have to do some additional cleanup, eg by appending
-replace '[\\x01-\\x1F]'
to the GetString()
call. 您将不得不进行一些额外的清理,例如通过在
GetString()
调用中附加-replace '[\\x01-\\x1F]'
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.