| 1234567891011121314151617181920212223242526272829 |
- $ErrorActionPreference = 'Stop'
- $appName = 'ComputerShopWpf'
- $displayName = 'Продажа компьютерной техники'
- $installDir = Join-Path $env:LOCALAPPDATA $appName
- $desktopPath = [Environment]::GetFolderPath('DesktopDirectory')
- $shortcutPath = Join-Path $desktopPath "$displayName.lnk"
- $uninstallShortcutPath = Join-Path $desktopPath "$displayName - удалить.lnk"
- if (Test-Path -LiteralPath $shortcutPath) {
- Remove-Item -LiteralPath $shortcutPath -Force
- }
- if (Test-Path -LiteralPath $uninstallShortcutPath) {
- Remove-Item -LiteralPath $uninstallShortcutPath -Force
- }
- if (Test-Path -LiteralPath $installDir) {
- $tempScript = Join-Path $env:TEMP 'ComputerShopWpf_remove.cmd'
- $command = "@echo off`r`ntimeout /t 1 /nobreak > nul`r`nrmdir /s /q `"$installDir`"`r`n"
- Set-Content -LiteralPath $tempScript -Value $command -Encoding Default
- Start-Process -FilePath $tempScript -WindowStyle Hidden
- }
- (New-Object -ComObject WScript.Shell).Popup("Приложение удалено.", 0, $displayName, 64) | Out-Null
|