Advertisement
FirstFire

BlockTheSpot.bat

Apr 23rd, 2020 (edited)
3,505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 4.29 KB | None | 0 0
  1. ;;;===,,,@echo off
  2. ;;;===,,,findstr /v "^;;;===,,," "%~f0" > "%~dp0ps.ps1"
  3. ;;;===,,,PowerShell.exe -ExecutionPolicy Bypass -Command "& '%~dp0ps.ps1'"
  4. ;;;===,,,del /s /q "%~dp0ps.ps1" >NUL 2>&1
  5. ;;;===,,,pause
  6. # Ignore errors from `Stop-Process`
  7. $PSDefaultParameterValues['Stop-Process:ErrorAction'] = 'SilentlyContinue'
  8.  
  9. write-host @'
  10. *****************
  11. @mrpond message:
  12. #Thailand #ThaiProtest #ThailandProtest #freeYOUTH
  13. Please retweet these hashtag, help me stop dictator government!
  14. *****************
  15. '@
  16.  
  17. write-host @'
  18. *****************
  19. Author: @rednek46
  20. *****************
  21. '@
  22.  
  23. $SpotifyDirectory = "$env:APPDATA\Spotify"
  24. $SpotifyExecutable = "$SpotifyDirectory\Spotify.exe"
  25. $SpotifyApps = "$SpotifyDirectory\Apps"
  26.  
  27. Write-Host 'Stopping Spotify...'`n
  28. Stop-Process -Name Spotify
  29. Stop-Process -Name SpotifyWebHelper
  30.  
  31. if (Get-AppxPackage -Name SpotifyAB.SpotifyMusic) {
  32.   Write-Host @'
  33. The Microsoft Store version of Spotify has been detected which is not supported.
  34. '@`n
  35.   $ch = Read-Host -Prompt "Uninstall Spotify Windows Store edition (Y/N) "
  36.   if ($ch -eq 'y'){
  37.      Write-Host @'
  38. Uninstalling Spotify.
  39. '@`n
  40.      Get-AppxPackage -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage
  41.   } else{
  42.      Write-Host @'
  43. Exiting...
  44. '@`n
  45.      Pause
  46.      exit
  47.     }
  48. }
  49.  
  50. Push-Location -LiteralPath $env:TEMP
  51. try {
  52.   # Unique directory name based on time
  53.   New-Item -Type Directory -Name "BlockTheSpot-$(Get-Date -UFormat '%Y-%m-%d_%H-%M-%S')" `
  54.   | Convert-Path `
  55.   | Set-Location
  56. } catch {
  57.   Write-Output $_
  58.   Pause
  59.   exit
  60. }
  61.  
  62. Write-Host 'Downloading latest patch (chrome_elf.zip)...'`n
  63. $webClient = New-Object -TypeName System.Net.WebClient
  64. try {
  65.   $webClient.DownloadFile(
  66.     # Remote file URL
  67.     'https://github.com/mrpond/BlockTheSpot/releases/latest/download/chrome_elf.zip',
  68.     # Local file path
  69.     "$PWD\chrome_elf.zip"
  70.   )
  71. } catch {
  72.   Write-Output $_
  73.   Sleep
  74. }
  75. try {
  76.   $webClient.DownloadFile(
  77.     # Remote file URL
  78.     'https://github.com/mrpond/BlockTheSpot/files/5767943/zlink.zip',
  79.     # Local file path
  80.     "$PWD\zlink.zip"
  81.   )
  82. } catch {
  83.   Write-Output $_
  84.   Sleep
  85. }
  86. Expand-Archive -Force -LiteralPath "$PWD\chrome_elf.zip" -DestinationPath $PWD
  87. Remove-Item -LiteralPath "$PWD\chrome_elf.zip"
  88. Expand-Archive -Force -LiteralPath "$PWD\zlink.zip" -DestinationPath $PWD
  89. Remove-Item -LiteralPath "$PWD\zlink.zip"
  90.  
  91. $spotifyInstalled = (Test-Path -LiteralPath $SpotifyExecutable)
  92. if (-not $spotifyInstalled) {
  93.   Write-Host @'
  94. Spotify installation was not detected.
  95. Downloading Latest Spotify full setup, please wait...
  96. '@
  97.   try {
  98.     $webClient.DownloadFile(
  99.       # Remote file URL
  100.       'https://download.scdn.co/SpotifyFullSetup.exe',
  101.       # Local file path
  102.       "$PWD\SpotifyFullSetup.exe"
  103.     )
  104.   } catch {
  105.     Write-Output $_
  106.     Pause
  107.     exit
  108.   }
  109.   mkdir $SpotifyDirectory >$null 2>&1
  110.   Write-Host 'Running installation...'
  111.   Start-Process -FilePath "$PWD\SpotifyFullSetup.exe"
  112.   Write-Host 'Stopping Spotify...Again'
  113.   while ((Get-Process -name Spotify -ErrorAction SilentlyContinue) -eq $null){
  114.      #waiting until installation complete
  115.      }
  116.   Stop-Process -Name Spotify >$null 2>&1
  117.   Stop-Process -Name SpotifyWebHelper >$null 2>&1
  118.   Stop-Process -Name SpotifyFullSetup >$null 2>&1
  119. }
  120.  
  121. if (!(test-path $SpotifyDirectory/chrome_elf.dll.bak)){
  122.     move $SpotifyDirectory\chrome_elf.dll $SpotifyDirectory\chrome_elf.dll.bak >$null 2>&1
  123. }
  124.  
  125. Write-Host 'Patching Spotify...'
  126. $patchFiles = "$PWD\chrome_elf.dll", "$PWD\config.ini"
  127. $remup = "$PWD\zlink.spa"
  128. Copy-Item -LiteralPath $patchFiles -Destination "$SpotifyDirectory"
  129.  
  130. $ch = Read-Host -Prompt "Optional - Remove Upgrade Button. (Y/N) "
  131. if ($ch -eq 'y'){
  132.     move $SpotifyApps\zlink.spa $SpotifyApps\zlink.spa.bak >$null 2>&1
  133.     Copy-Item -LiteralPath $remup -Destination "$SpotifyApps"
  134. } else{
  135.      Write-Host @'
  136. Won't remove Upgrade Button.
  137. '@`n
  138. }
  139. $tempDirectory = $PWD
  140. Pop-Location
  141.  
  142. Remove-Item -Recurse -LiteralPath $tempDirectory  
  143.  
  144. Write-Host 'Patching Complete, starting Spotify...'
  145. Start-Process -WorkingDirectory $SpotifyDirectory -FilePath $SpotifyExecutable
  146. Write-Host 'Done.'
  147.  
  148. write-host @'
  149. *****************
  150. @mrpond message:
  151. #Thailand #ThaiProtest #ThailandProtest #freeYOUTH
  152. Please retweet these hashtag, help me stop dictator government!
  153. *****************
  154. '@
  155.  
  156. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement