Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##################################################################################################################
- # THIS IS A SCRIPT TO AUTOMATE THE PROCESS OF https://github.com/sdushantha/recycle-bin-themes #
- # PLEASE SEE https://www.reddit.com/r/pcmasterrace/comments/uw2se4/i_made_a_patrick_star_version_of_the_cat_bin/ #
- ##################################################################################################################
- #Check for Administrator privileges and if not, open powershell as admin and rerun the script
- Write-Host "Checking for elevated privileges"
- If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) {
- Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
- Exit
- }
- # Set the working location to the same location as the script
- Write-Host "Setting Working Directory to Script Root"
- Set-Location $PSScriptRoot
- #Get .ico files from github the hard way
- #patrik-star-empty.ico
- $pstarempty = "https://raw.githubusercontent.com/sdushantha/recycle-bin-themes/main/themes/patrick-star/patrik-star-empty.ico"
- #patrik-star-full.ico
- $pstarfull = "https://raw.githubusercontent.com/sdushantha/recycle-bin-themes/main/themes/patrick-star/patrik-star-full.ico"
- #pop-cat-empty.ico
- $pcatempty = "https://raw.githubusercontent.com/sdushantha/recycle-bin-themes/main/themes/pop-cat/pop-cat-empty.ico"
- #pop-cat-full.ico
- $pcatfull = "https://raw.githubusercontent.com/sdushantha/recycle-bin-themes/main/themes/pop-cat/pop-cat-full.ico"
- #Get user choice
- Write-Host "Please choose your theme:"
- $choice = Read-Host "Enter [1]POPCAT or [2]Patrik Star or [3]Default"
- if ($choice -eq '1' -or $choice -eq '2' -or $choice -eq '3') {
- Write-Host "You picked" $choice
- }else{
- Write-Host "You picked" $choice
- Write-Host "Please enter 1, 2, or 3."
- }
- if ($choice -eq '1')
- {
- Write-Host "Downloading POPCAT Empty Icon"
- $url = $pcatempty
- $output = "$PSScriptRoot\pop-cat-empty.ico"
- Invoke-WebRequest -Uri $url -OutFile $output
- Write-Host "Downloading POPCAT Full Icon"
- $url = $pcatfull
- $output = "$PSScriptRoot\pop-cat-full.ico"
- Write-Host "Setting Registry"
- Invoke-WebRequest -Uri $url -OutFile $output
- Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon" -Name "(Default)" -Value "$PSScriptRoot\pop-cat-empty.ico,0"
- Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon" -Name "full" -Value "$PSScriptRoot\pop-cat-full.ico,0"
- Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon" -Name "empty" -Value "$PSScriptRoot\pop-cat-empty.ico,0"
- }
- if ($choice -eq '2')
- {
- Write-Host "Downloading Patrik Star Empty Icon"
- $url = $pstarempty
- $output = "$PSScriptRoot\patrik-star-empty.ico"
- Invoke-WebRequest -Uri $url -OutFile $output
- Write-Host "Downloading Patrik Star Full Icon"
- $url = $pstarfull
- $output = "$PSScriptRoot\patrik-star-full.ico"
- Write-Host "Setting Registry"
- Invoke-WebRequest -Uri $url -OutFile $output
- Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon" -Name "(Default)" -Value "$PSScriptRoot\patrik-star-empty.ico,0"
- Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon" -Name "full" -Value "$PSScriptRoot\patrik-star-full.ico,0"
- Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon" -Name "empty" -Value "$PSScriptRoot\patrik-star-empty.ico,0"
- }
- if ($choice -eq '3')
- {
- Write-Host "Resetting to default settings"
- Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon" -Name "(Default)" -Value "%SystemRoot%\System32\imageres.dll,-55"
- Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon" -Name "full" -Value "%SystemRoot%\System32\imageres.dll,-54"
- Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon" -Name "empty" -Value "%SystemRoot%\System32\imageres.dll,-55"
- }
- #Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon
- #Default
- #(Default) = %SystemRoot%\System32\imageres.dll,-55
- #empty = %SystemRoot%\System32\imageres.dll,-55
- #full = %SystemRoot%\System32\imageres.dll,-54
- #Refresh Desktop
- $code = @'
- [System.Runtime.InteropServices.DllImport("Shell32.dll")]
- private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
- public static void Refresh() {
- SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero);
- }
- '@
- Add-Type -MemberDefinition $code -Namespace WinAPI -Name Explorer
- [WinAPI.Explorer]::Refresh()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement