mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-04-13 20:28:25 +10:00
Update Install_rus.ps1
- Добавил правило если папка рабочего стола была не найдена - допил возможных варианты ответов
This commit is contained in:
106
Install_rus.ps1
106
Install_rus.ps1
@@ -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
|
||||
|
||||
# Shortcut bug
|
||||
$ErrorActionPreference = 'SilentlyContinue'
|
||||
|
||||
If (!(Test-Path $env:USERPROFILE\Desktop\Spotify.lnk)) {
|
||||
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
||||
$target = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
||||
$WorkingDir = "$env:APPDATA\Spotify"
|
||||
$WshShell = New-Object -comObject WScript.Shell
|
||||
$Shortcut = $WshShell.CreateShortcut($target)
|
||||
$Shortcut.WorkingDirectory = $WorkingDir
|
||||
$Shortcut.TargetPath = $source
|
||||
$Shortcut.Save()
|
||||
}
|
||||
@@ -297,19 +301,25 @@ if ($ch -eq 'n') {
|
||||
|
||||
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 ($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) {
|
||||
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_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) {
|
||||
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
|
||||
|
||||
# Если папки по умолчанию Dekstop не существует, то установку кэша отменить.
|
||||
if ($desktop_folder -match '\bDirectory\b') {
|
||||
|
||||
|
||||
|
||||
If ($test_cache_spotify_ps) {
|
||||
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
|
||||
$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
|
||||
$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"
|
||||
$WshShell = New-Object -comObject WScript.Shell
|
||||
$Shortcut = $WshShell.CreateShortcut($target)
|
||||
$Shortcut.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
||||
$Shortcut.TargetPath = $source
|
||||
$Shortcut.Save()
|
||||
|
||||
|
||||
# Spotify.lnk
|
||||
$source2 = "$env:APPDATA\Spotify\Spotify.vbs"
|
||||
$target2 = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
||||
$WorkingDir2 = "$env:APPDATA\Spotify"
|
||||
$WshShell2 = New-Object -comObject WScript.Shell
|
||||
$Shortcut2 = $WshShell2.CreateShortcut($target2)
|
||||
$Shortcut2.WorkingDirectory = $WorkingDir2
|
||||
$Shortcut2.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
||||
$Shortcut2.TargetPath = $source2
|
||||
$Shortcut2.Save()
|
||||
|
||||
$ch = Read-Host -Prompt "Файлы кэша, которые не использовались более XX дней, будут удалены.
|
||||
Пожалуйста, введите количество дней от 1 до 100"
|
||||
@@ -390,9 +410,15 @@ if ($ch -eq 'y') {
|
||||
exit
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
Write-Host "Ошибка, не могу найти папку Рабочего стола" -ForegroundColor Red
|
||||
Write-Host "Установка завершена" -ForegroundColor Green
|
||||
|
||||
Exit
|
||||
}
|
||||
}
|
||||
|
||||
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\Spotify.vbs -Recurse -Force
|
||||
|
||||
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
||||
$target = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
||||
$WshShell = New-Object -comObject WScript.Shell
|
||||
$Shortcut = $WshShell.CreateShortcut($target)
|
||||
$Shortcut.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
||||
$Shortcut.TargetPath = $source
|
||||
$Shortcut.Save()
|
||||
Write-Host "Скрипт для очистки кэша был удален" -ForegroundColor Green
|
||||
$source3 = "$env:APPDATA\Spotify\Spotify.exe"
|
||||
$target3 = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
||||
$WorkingDir3 = "$env:APPDATA\Spotify"
|
||||
$WshShell3 = New-Object -comObject WScript.Shell
|
||||
$Shortcut3 = $WshShell3.CreateShortcut($target3)
|
||||
$Shortcut3.WorkingDirectory = $WorkingDir3
|
||||
$Shortcut3.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
||||
$Shortcut3.TargetPath = $source3
|
||||
$Shortcut3.Save()
|
||||
Write-Host "Очистка кэша удалена" -ForegroundColor Green
|
||||
Write-Host "Установка завершена" -ForegroundColor Green
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
If (!($test_cache_spotify_ps -and $test_spotify_vbs)) {
|
||||
Write-Host "Ого, скрипт очистки кэша не найден"
|
||||
Write-Host "Установка завершена" -ForegroundColor Green
|
||||
|
||||
Reference in New Issue
Block a user