# StockBot 작업 스케줄러 등록 # 관리자 권한 없이도 현재 사용자 계정으로 등록 가능 $PROJECT = "C:\Users\whdwo\OneDrive\바탕 화면\stockbot_v3" # ── 평일(월~금) 트리거 ────────────────────────────────────────────────────── $weekdays = @( [DayOfWeek]::Monday, [DayOfWeek]::Tuesday, [DayOfWeek]::Wednesday, [DayOfWeek]::Thursday, [DayOfWeek]::Friday ) # ── Task 1: claude_morning (08:15, 평일) ──────────────────────────────────── $morningTrigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek $weekdays -At "08:15" $morningAction = New-ScheduledTaskAction ` -Execute "powershell.exe" ` -Argument "-NonInteractive -ExecutionPolicy Bypass -File `"$PROJECT\scripts\run_morning.ps1`"" ` -WorkingDirectory $PROJECT $morningSettings = New-ScheduledTaskSettingsSet ` -ExecutionTimeLimit (New-TimeSpan -Minutes 20) ` -StartWhenAvailable Register-ScheduledTask ` -TaskName "StockBot_Morning" ` -TaskPath "\StockBot\" ` -Trigger $morningTrigger ` -Action $morningAction ` -Settings $morningSettings ` -RunLevel Limited ` -Force Write-Host "[OK] StockBot_Morning 등록 완료 (평일 08:15)" -ForegroundColor Green # ── Task 2: 매매봇 (07:55, 평일) ──────────────────────────────────────────── $botTrigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek $weekdays -At "07:55" $botAction = New-ScheduledTaskAction ` -Execute "cmd.exe" ` -Argument "/c `"$PROJECT\scripts\run_bot.bat`"" ` -WorkingDirectory $PROJECT $botSettings = New-ScheduledTaskSettingsSet ` -ExecutionTimeLimit (New-TimeSpan -Hours 8) ` -StartWhenAvailable Register-ScheduledTask ` -TaskName "StockBot_Bot" ` -TaskPath "\StockBot\" ` -Trigger $botTrigger ` -Action $botAction ` -Settings $botSettings ` -RunLevel Limited ` -Force Write-Host "[OK] StockBot_Bot 등록 완료 (평일 07:55)" -ForegroundColor Green Write-Host "" Write-Host "등록된 작업 확인:" -ForegroundColor Cyan Get-ScheduledTask -TaskPath "\StockBot\" | Select-Object TaskName, State