0

I am trying to find a way of getting the "real path" of my actual desktop background. I use a slideshow and got many files (4k+) in the folder, some I want to delete the fast way.

What I've tried so far: %AppData%\Microsoft\Windows\Themes\CachedFiles - only contains the actual image %AppData%\Microsoft\Windows\Themes\TranscodedWallpaper - filepath and filename transcoded

HKEY_CURRENT_USER\Control Panel\Desktop\WallPaper - directs to the file above HKEY_CURRENT_USER\Control Panel\Desktop\TranscodedImageCache - same as above

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers - only shows the copies of the files


My solution after some research:

With the transcoded path from HKEY_CURRENT_USER\Control Panel\Desktop\TranscodedImageCache

I created a command

$TIC=(Get-ItemProperty 'HKCU:\Control Panel\Desktop' TranscodedImageCache -ErrorAction Stop).TranscodedImageCache
[System.Text.Encoding]::Unicode.GetString($TIC) -replace '(.+)([A-Z]:[0-9a-zA-Z\\])+','$2'

This one is working in a *.ps1 file or in powershell terminal:

Start-Process -FilePath "$env:SystemRoot\explorer.exe" -ArgumentList "/select,`"$([System.Text.Encoding]::Unicode.GetString((Get-ItemProperty 'HKCU:\Control Panel\Desktop' TranscodedImageCache -ErrorAction Stop).TranscodedImageCache) -replace '(.+)([A-Z]:[0-9a-zA-Z\\])+','$2')`""

And tried adding it to the right click menu of windows background

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\DesktopBackground\Shell\WPTargetDir]
@="Open Desktop Background File Location"
icon="imageres.dll,108"
position="bottom"

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\WPTargetDir\command] @="PowerShell -Command "Start-Process -FilePath "$env:SystemRoot\explorer.exe" -ArgumentList "/select,"$([System.Text.Encoding]::Unicode.GetString((Get-ItemProperty 'HKCU:\Control Panel\Desktop' TranscodedImageCache -ErrorAction Stop).TranscodedImageCache) -replace '(.+)([A-Z]:[0-9a-zA-Z\])+','$2')"";Read-Host""

*the Read-Host is only to catch the error message

I get a error, can someone explain to me why or have a solution?

Error is "No position parameter was found that accepts the argument "<path_to_file>".

+ Start-Process -FilePath `$env:SystemRoot\explorer.exe` -ArgumentList  ...                                             
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                     
+ CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException                               
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand 

Thank you

1 Answers1

0

Solution:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\WPTargetDir] "icon"="imageres.dll,108" @="Open Desktop Background File Location"

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\WPTargetDir\command] @=hex(2):25,00,63,00,6f,00,6d,00,73,00,70,00,65,00,63,00,25,00,20,00,2f,00,51,
00,20,00,2f,00,53,00,20,00,2f,00,43,00,20,00,22,00,20,00,66,00,6f,00,72,00,
20,00,2f,00,66,00,20,00,22,00,75,00,73,00,65,00,62,00,61,00,63,00,6b,00,71,
00,20,00,64,00,65,00,6c,00,69,00,6d,00,73,00,3d,00,22,00,20,00,25,00,25,00,
61,00,20,00,69,00,6e,00,20,00,28,00,60,00,70,00,6f,00,77,00,65,00,72,00,73,
00,68,00,65,00,6c,00,6c,00,20,00,5b,00,53,00,79,00,73,00,74,00,65,00,6d,00,
2e,00,54,00,65,00,78,00,74,00,2e,00,45,00,6e,00,63,00,6f,00,64,00,69,00,6e,
00,67,00,5d,00,3a,00,3a,00,55,00,6e,00,69,00,63,00,6f,00,64,00,65,00,2e,00,
47,00,65,00,74,00,53,00,74,00,72,00,69,00,6e,00,67,00,28,00,28,00,47,00,65,
00,74,00,2d,00,49,00,74,00,65,00,6d,00,50,00,72,00,6f,00,70,00,65,00,72,00,
74,00,79,00,20,00,27,00,48,00,4b,00,43,00,55,00,3a,00,5c,00,43,00,6f,00,6e,
00,74,00,72,00,6f,00,6c,00,20,00,50,00,61,00,6e,00,65,00,6c,00,5c,00,44,00,
65,00,73,00,6b,00,74,00,6f,00,70,00,27,00,20,00,54,00,72,00,61,00,6e,00,73,
00,63,00,6f,00,64,00,65,00,64,00,49,00,6d,00,61,00,67,00,65,00,43,00,61,00,
63,00,68,00,65,00,20,00,2d,00,45,00,72,00,72,00,6f,00,72,00,41,00,63,00,74,
00,69,00,6f,00,6e,00,20,00,53,00,74,00,6f,00,70,00,5e,00,29,00,2e,00,54,00,
72,00,61,00,6e,00,73,00,63,00,6f,00,64,00,65,00,64,00,49,00,6d,00,61,00,67,
00,65,00,43,00,61,00,63,00,68,00,65,00,5e,00,29,00,20,00,2d,00,72,00,65,00,
70,00,6c,00,61,00,63,00,65,00,20,00,27,00,28,00,2e,00,2b,00,5e,00,29,00,28,
00,5b,00,41,00,2d,00,5a,00,5d,00,3a,00,5b,00,30,00,2d,00,39,00,61,00,2d,00,
7a,00,41,00,2d,00,5a,00,5c,00,5c,00,5d,00,5e,00,29,00,2b,00,27,00,5e,00,2c,
00,27,00,24,00,32,00,27,00,60,00,29,00,20,00,64,00,6f,00,20,00,63,00,61,00,
6c,00,6c,00,20,00,22,00,25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,
00,6f,00,74,00,25,00,5c,00,65,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,
2e,00,65,00,78,00,65,00,22,00,20,00,2f,00,73,00,65,00,6c,00,65,00,63,00,74,
00,2c,00,22,00,25,00,25,00,61,00,22,00,20,00,22,00,00,00

%comspec% /Q /S /C " for /f "usebackq delims=" %%a in (`powershell [System.Text.Encoding]::Unicode.GetString((Get-ItemProperty 'HKCU:\Control Panel\Desktop' TranscodedImageCache -ErrorAction Stop^).TranscodedImageCache^) -replace '(.+^)([A-Z]:[0-9a-zA-Z\\]^)+'^,'$2'`) do call "%systemroot%\explorer.exe" /select,"%%a" "

Can not start it silent/quiet, with Start "" \B it says "explorer.exe not found"