Напоминания в Windows
Хранит напоминания в JSON, показывает просроченные и умеет выводить всплывающее окно.
Что делает скрипт
Напоминание содержит текст, время и отметку выполнения. Команда Due выбирает записи, срок которых уже наступил, и по флагу Popup показывает окно через системный WScript.Shell. Файл данных обновляется с резервной копией.
- Файл напоминаний перезаписывается при добавлении и отметке выполнения. Создаётся копия .bak.
Быстрый старт
powershell -File Reminders.ps1 -Action Add -Text "Позвонить" -At "2026-11-10 09:00"
Скачайте файл, откройте терминал в папке со скриптом и выполните команду. Запускайте в PowerShell 5.1 или PowerShell 7.
Другие варианты
powershell -File Reminders.ps1 -Action Add -Text "Проверить почту" -At "2026-11-10 18:00"powershell -File Reminders.ps1 -Action Due -Popuppowershell -File Reminders.ps1 -Action Done -Id 1
Что понадобится
Встроен в Windows 10/11 (PowerShell 5.1)
Reminders.ps1
[CmdletBinding()]
param(
[ValidateSet('Add', 'List', 'Due', 'Done')]
[string]$Action = 'List',
[string]$Text,
[string]$At,
[int]$Id,
[string]$Data = (Join-Path $env:APPDATA 'Productivity\reminders.json'),
[switch]$Popup
)
$ErrorActionPreference = 'Stop'
function Read-Reminders {
param([string]$Path)
if (-not (Test-Path -LiteralPath $Path)) { return @() }
$raw = Get-Content -LiteralPath $Path -Raw -Encoding UTF8
if ([string]::IsNullOrWhiteSpace($raw)) { return @() }
$items = $raw | ConvertFrom-Json
if ($null -eq $items) { return @() }
return @($items)
}
function Save-Reminders {
param([string]$Path, [object[]]$Items)
$directory = Split-Path -LiteralPath $Path
if ($directory -and -not (Test-Path -LiteralPath $directory)) {
New-Item -ItemType Directory -Path $directory -Force | Out-Null
}
if (Test-Path -LiteralPath $Path) {
Copy-Item -LiteralPath $Path -Destination ($Path + '.bak') -Force
}
$json = ConvertTo-Json -InputObject @($Items) -Depth 5
Set-Content -LiteralPath $Path -Value $json -Encoding UTF8
}
$items = Read-Reminders -Path $Data
switch ($Action) {
'Add' {
if ([string]::IsNullOrWhiteSpace($Text)) {
throw 'Укажите текст напоминания через -Text.'
}
if ([string]::IsNullOrWhiteSpace($At)) {
throw 'Укажите время через -At, например "2026-11-10 09:00".'
}
$when = [datetime]::MinValue
if (-not [datetime]::TryParse($At, [ref]$when)) {
throw "Не удалось разобрать дату: $At"
}
$nextId = 1
if ($items.Count -gt 0) {
$nextId = ([int]($items | Measure-Object -Property id -Maximum).Maximum) + 1
}
$entry = [pscustomobject]@{
id = $nextId
text = $Text
at = $when.ToString('s')
done = $false
}
$items = @($items) + $entry
Save-Reminders -Path $Data -Items $items
Write-Host ("Добавлено #{0}: {1} ({2})" -f $nextId, $Text, $when.ToString('yyyy-MM-dd HH:mm'))
}
'List' {
if ($items.Count -eq 0) {
Write-Host 'Напоминаний нет.'
break
}
$items |
Sort-Object -Property at |
ForEach-Object {
$status = if ($_.done) { 'готово' } else { 'активно' }
Write-Host ("#{0} [{1}] {2} - {3}" -f $_.id, $status, $_.at, $_.text)
}
}
'Due' {
$now = Get-Date
$due = @($items | Where-Object {
-not $_.done -and [datetime]::Parse($_.at) -le $now
} | Sort-Object -Property at)
if ($due.Count -eq 0) {
Write-Host 'Просроченных напоминаний нет.'
break
}
foreach ($item in $due) {
$message = "$($item.text)`n$($item.at)"
Write-Host ("#{0} {1}" -f $item.id, $message)
if ($Popup) {
$shell = New-Object -ComObject WScript.Shell
$shell.Popup($message, 30, 'Напоминание', 64) | Out-Null
}
}
}
'Done' {
if ($Id -le 0) {
throw 'Укажите номер напоминания через -Id.'
}
$found = $false
foreach ($item in $items) {
if ([int]$item.id -eq $Id) {
$item.done = $true
$found = $true
}
}
if (-not $found) {
throw "Напоминание #$Id не найдено."
}
Save-Reminders -Path $Data -Items $items
Write-Host "Напоминание #$Id отмечено выполненным."
}
}
Скрипты работают с файлами и настройками системы. Перед запуском прочитайте код и проверьте пути. Особенно если скрипт удаляет, перезаписывает или перемещает данные.