mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-06-20 14:10:54 +10:00
Update Install_rus.ps1
- Добавил правило если папка рабочего стола была не найдена - допил возможных варианты ответов
This commit is contained in:
+69
-35
@@ -200,11 +200,15 @@ Rename-Item -path $env:APPDATA\Spotify\Apps\xpui.zip -NewName $env:APPDATA\Spoti
|
|||||||
Remove-item $env:APPDATA\Spotify\Apps\temporary -Recurse
|
Remove-item $env:APPDATA\Spotify\Apps\temporary -Recurse
|
||||||
|
|
||||||
# Shortcut bug
|
# Shortcut bug
|
||||||
|
$ErrorActionPreference = 'SilentlyContinue'
|
||||||
|
|
||||||
If (!(Test-Path $env:USERPROFILE\Desktop\Spotify.lnk)) {
|
If (!(Test-Path $env:USERPROFILE\Desktop\Spotify.lnk)) {
|
||||||
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
$target = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
$target = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
||||||
|
$WorkingDir = "$env:APPDATA\Spotify"
|
||||||
$WshShell = New-Object -comObject WScript.Shell
|
$WshShell = New-Object -comObject WScript.Shell
|
||||||
$Shortcut = $WshShell.CreateShortcut($target)
|
$Shortcut = $WshShell.CreateShortcut($target)
|
||||||
|
$Shortcut.WorkingDirectory = $WorkingDir
|
||||||
$Shortcut.TargetPath = $source
|
$Shortcut.TargetPath = $source
|
||||||
$Shortcut.Save()
|
$Shortcut.Save()
|
||||||
}
|
}
|
||||||
@@ -297,19 +301,25 @@ if ($ch -eq 'n') {
|
|||||||
|
|
||||||
if ($ch -eq 'u') {
|
if ($ch -eq 'u') {
|
||||||
|
|
||||||
|
If ($migrator_bak -and $Check_folder_file -match '\bSystem\b' -and $Check_folder_file -match '\bReadOnly\b') {
|
||||||
If ($update_directory_file) {
|
|
||||||
Remove-item $env:LOCALAPPDATA\Spotify\Update -Recurse -Force
|
|
||||||
}
|
|
||||||
If ($migrator_bak -and $migrator_exe ) {
|
|
||||||
Remove-item $env:APPDATA\Spotify\SpotifyMigrator.bak -Recurse -Force
|
|
||||||
}
|
|
||||||
if ($migrator_bak) {
|
|
||||||
Rename-Item -path $env:APPDATA\Spotify\SpotifyMigrator.bak -NewName $env:APPDATA\Spotify\SpotifyMigrator.exe
|
|
||||||
}
|
|
||||||
Write-Host "Обновления разблокированы" -ForegroundColor Green
|
|
||||||
|
|
||||||
|
|
||||||
|
If ($update_directory_file) {
|
||||||
|
Remove-item $env:LOCALAPPDATA\Spotify\Update -Recurse -Force
|
||||||
|
}
|
||||||
|
If ($migrator_bak -and $migrator_exe ) {
|
||||||
|
Remove-item $env:APPDATA\Spotify\SpotifyMigrator.bak -Recurse -Force
|
||||||
|
}
|
||||||
|
if ($migrator_bak) {
|
||||||
|
Rename-Item -path $env:APPDATA\Spotify\SpotifyMigrator.bak -NewName $env:APPDATA\Spotify\SpotifyMigrator.exe
|
||||||
|
}
|
||||||
|
Write-Host "Обновления разблокированы" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
If (!($migrator_bak -and $Check_folder_file -match '\bSystem\b' -and $Check_folder_file -match '\bReadOnly\b')) {
|
||||||
|
Write-Host "Ого, обновления не были заблокированы"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -330,15 +340,21 @@ if ($ch -eq 'y') {
|
|||||||
|
|
||||||
$test_cache_spotify_ps = Test-Path -Path $env:APPDATA\Spotify\cache-spotify.ps1
|
$test_cache_spotify_ps = Test-Path -Path $env:APPDATA\Spotify\cache-spotify.ps1
|
||||||
$test_spotify_vbs = Test-Path -Path $env:APPDATA\Spotify\Spotify.vbs
|
$test_spotify_vbs = Test-Path -Path $env:APPDATA\Spotify\Spotify.vbs
|
||||||
|
$desktop_folder = Get-ItemProperty -Path $env:USERPROFILE\Desktop | SELECT Attributes
|
||||||
|
|
||||||
|
|
||||||
If ($test_cache_spotify_ps) {
|
# Если папки по умолчанию Dekstop не существует, то установку кэша отменить.
|
||||||
Remove-item $env:APPDATA\Spotify\cache-spotify.ps1 -Recurse -Force
|
if ($desktop_folder -match '\bDirectory\b') {
|
||||||
}
|
|
||||||
If ($test_spotify_vbs) {
|
|
||||||
Remove-item $env:APPDATA\Spotify\Spotify.vbs -Recurse -Force
|
|
||||||
}
|
If ($test_cache_spotify_ps) {
|
||||||
sleep -Milliseconds 200
|
Remove-item $env:APPDATA\Spotify\cache-spotify.ps1 -Recurse -Force
|
||||||
|
}
|
||||||
|
If ($test_spotify_vbs) {
|
||||||
|
Remove-item $env:APPDATA\Spotify\Spotify.vbs -Recurse -Force
|
||||||
|
}
|
||||||
|
sleep -Milliseconds 200
|
||||||
|
|
||||||
# cache-spotify.ps1
|
# cache-spotify.ps1
|
||||||
$webClient.DownloadFile('https://raw.githubusercontent.com/amd64fox/SpotX/main/cache_spotify_ru.ps1', "$env:APPDATA\Spotify\cache-spotify.ps1")
|
$webClient.DownloadFile('https://raw.githubusercontent.com/amd64fox/SpotX/main/cache_spotify_ru.ps1', "$env:APPDATA\Spotify\cache-spotify.ps1")
|
||||||
@@ -346,14 +362,18 @@ if ($ch -eq 'y') {
|
|||||||
# Spotify.vbs
|
# Spotify.vbs
|
||||||
$webClient.DownloadFile('https://raw.githubusercontent.com/amd64fox/SpotX/main/Spotify.vbs', "$env:APPDATA\Spotify\Spotify.vbs")
|
$webClient.DownloadFile('https://raw.githubusercontent.com/amd64fox/SpotX/main/Spotify.vbs', "$env:APPDATA\Spotify\Spotify.vbs")
|
||||||
|
|
||||||
# Spotify.lnk
|
|
||||||
$source = "$env:APPDATA\Spotify\Spotify.vbs"
|
|
||||||
$target = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
# Spotify.lnk
|
||||||
$WshShell = New-Object -comObject WScript.Shell
|
$source2 = "$env:APPDATA\Spotify\Spotify.vbs"
|
||||||
$Shortcut = $WshShell.CreateShortcut($target)
|
$target2 = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
||||||
$Shortcut.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
$WorkingDir2 = "$env:APPDATA\Spotify"
|
||||||
$Shortcut.TargetPath = $source
|
$WshShell2 = New-Object -comObject WScript.Shell
|
||||||
$Shortcut.Save()
|
$Shortcut2 = $WshShell2.CreateShortcut($target2)
|
||||||
|
$Shortcut2.WorkingDirectory = $WorkingDir2
|
||||||
|
$Shortcut2.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
|
$Shortcut2.TargetPath = $source2
|
||||||
|
$Shortcut2.Save()
|
||||||
|
|
||||||
$ch = Read-Host -Prompt "Файлы кэша, которые не использовались более XX дней, будут удалены.
|
$ch = Read-Host -Prompt "Файлы кэша, которые не использовались более XX дней, будут удалены.
|
||||||
Пожалуйста, введите количество дней от 1 до 100"
|
Пожалуйста, введите количество дней от 1 до 100"
|
||||||
@@ -390,9 +410,15 @@ if ($ch -eq 'y') {
|
|||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Ошибка, не могу найти папку Рабочего стола" -ForegroundColor Red
|
||||||
|
Write-Host "Установка завершена" -ForegroundColor Green
|
||||||
|
|
||||||
|
Exit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ch -eq 'n') {
|
if ($ch -eq 'n') {
|
||||||
@@ -410,17 +436,25 @@ if ($ch -eq 'u') {
|
|||||||
Remove-item $env:APPDATA\Spotify\cache-spotify.ps1 -Recurse -Force
|
Remove-item $env:APPDATA\Spotify\cache-spotify.ps1 -Recurse -Force
|
||||||
Remove-item $env:APPDATA\Spotify\Spotify.vbs -Recurse -Force
|
Remove-item $env:APPDATA\Spotify\Spotify.vbs -Recurse -Force
|
||||||
|
|
||||||
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
$source3 = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
$target = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
$target3 = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
||||||
$WshShell = New-Object -comObject WScript.Shell
|
$WorkingDir3 = "$env:APPDATA\Spotify"
|
||||||
$Shortcut = $WshShell.CreateShortcut($target)
|
$WshShell3 = New-Object -comObject WScript.Shell
|
||||||
$Shortcut.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
$Shortcut3 = $WshShell3.CreateShortcut($target3)
|
||||||
$Shortcut.TargetPath = $source
|
$Shortcut3.WorkingDirectory = $WorkingDir3
|
||||||
$Shortcut.Save()
|
$Shortcut3.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
Write-Host "Скрипт для очистки кэша был удален" -ForegroundColor Green
|
$Shortcut3.TargetPath = $source3
|
||||||
|
$Shortcut3.Save()
|
||||||
|
Write-Host "Очистка кэша удалена" -ForegroundColor Green
|
||||||
Write-Host "Установка завершена" -ForegroundColor Green
|
Write-Host "Установка завершена" -ForegroundColor Green
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If (!($test_cache_spotify_ps -and $test_spotify_vbs)) {
|
If (!($test_cache_spotify_ps -and $test_spotify_vbs)) {
|
||||||
Write-Host "Ого, скрипт очистки кэша не найден"
|
Write-Host "Ого, скрипт очистки кэша не найден"
|
||||||
Write-Host "Установка завершена" -ForegroundColor Green
|
Write-Host "Установка завершена" -ForegroundColor Green
|
||||||
|
|||||||
Reference in New Issue
Block a user