Files
my-botty-tools/tools/start_bot_detached.bat

10 lines
702 B
Batchfile

@echo off
:: Launch botty detached with console output captured to log\console_<rand>.log
:: (used for unattended/remote starts where no interactive console exists)
cd /d "C:\Users\alex\Downloads\my-botty"
:: Single-instance guard: F11/F12 are GLOBAL hotkeys, so two bot instances
:: receive every press and fight each other (one starts, the other pauses).
powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter \"Name='python.exe'\" | Where-Object {$_.CommandLine -like '*my-botty*main.py*'} | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }"
set "TS=%RANDOM%"
call "C:\Users\alex\Downloads\my-botty\run_botty.bat" > "C:\Users\alex\Downloads\my-botty\log\console_%TS%.log" 2>&1