Skip to content

Instantly share code, notes, and snippets.

@sefgit
Created March 27, 2026 00:24
Show Gist options
  • Select an option

  • Save sefgit/65207f81fde4741164859b5b22c02379 to your computer and use it in GitHub Desktop.

Select an option

Save sefgit/65207f81fde4741164859b5b22c02379 to your computer and use it in GitHub Desktop.
Post cmd status to telegram
@echo off
SET CHATID=YOUR_CHAT_ID_NUMBER_WITH_MINUS_SIGN
SET TOKEN=YOUR_TELEGRAM_BOT_TOKEN
SET URL="https://api.telegram.org/bot%TOKEN%/sendMessage"
rem SET URL="https://httpbin.org/anything"
rem YOUR COMMAND TO EXECUTE ('qwinsta admin')
FOR /F "delims=" %%I IN ('qwinsta admin') DO SET RES=%%I
setlocal EnableDelayedExpansion
FOR /F "delims=" %%I IN ('echo %date% %RES%') DO SET INFO=%%I
FOR /F "delims=" %%I IN ('time /t') DO SET T=%%I
rem ECHO '{chat_id:%CHATID%, text:"%INFO%%T%"}'
curl -s -X POST %URL% -H "Content-Type: application/json" -d "{\"chat_id\":%CHATID%, \"text\":\"%INFO%%T%\"}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment