GEMTOK Docs
FeaturesStream StudioIntegration

Run Command

Execute system commands, scripts, and control hardware from live events

Run Command lets GEMTOK execute system commands, scripts, and control hardware when viewer events happen. It's the most powerful integration for advanced automation.

What is Run Command?

Run Command is a feature of GEMTOK Windows Toolkit that can:

  • Run .exe files
  • Execute batch files (.bat), PowerShell scripts (.ps1)
  • Run any command line command
  • Control smart home via command line tools
  • Trigger other software

Prerequisites

  • Windows 10 or newer
  • GEMTOK Windows Toolkit installed from Download page
  • .NET Framework 4.8+
  • Premium membership (Desktop Integration)
  • Basic knowledge of command line (for custom commands)

Types of Commands

1. Run Executable

  • Command: C:\Path\To\YourApp.exe
  • Use case: Launch custom app that does something with gift data

2. Batch File

  • Command: C:\Scripts\gift_alert.bat
  • Batch file content:
    @echo off
    echo Gift from %1 count %2 >> C:\Logs\gifts.log
    powershell -Command "(New-Object Media.SoundPlayer 'C:\Sounds\celebrate.wav').PlaySync()"
  • Use case: Log gifts, play sound via system, control lights via CLI

3. PowerShell Script

  • Command: powershell.exe
  • Args: -ExecutionPolicy Bypass -File C:\Scripts\discord.ps1 -Username '{username}' -Gift '{giftName}'
  • PowerShell script can do anything: HTTP requests, control Hue lights, etc.

Example PowerShell to control Philips Hue:

param($Username, $Gift)
$hueIp = "192.168.1.100"
$token = "your-hue-token"
$body = @{on=$true; hue=0; sat=254; bri=254} | ConvertTo-Json
Invoke-RestMethod -Uri "http://$hueIp/api/$token/lights/1/state" -Method Put -Body $body -ContentType "application/json"

Example Automations

Example 1: Log Gifts to File

  • Trigger: Any gift
  • Action: Run Command C:\Scripts\log.bat {'{username}'} {'{giftName}'} {'{giftCount}'} {'{platform}'}
  • Batch logs to file for later analysis

Example 2: Control Room Lights

  • Trigger: Gift count >= 10
  • Action: Run Command C:\Hue\celebrate.exe (exe that sets lights to party mode)
  • Result: Room lights flash when big gift received - very hype for IRL streams

Example 3: Play Sound via System (not browser)

  • Trigger: Follow
  • Action: Run Command powershell -c (New-Object Media.SoundPlayer 'C:\Sounds\follow.wav').PlaySync()
  • More reliable than browser audio for some setups

Example 4: Take Screenshot on Gift

  • Trigger: Gift
  • Action: Run Command C:\Tools\screenshot.exe C:\Screenshots\{'{username}'}_{'{timestamp}'}.png
  • Saves screenshot of moment gift received

Security & Safety

Run Command executes ANY command on your PC. This is powerful but dangerous if misconfigured. Follow security best practices.

  • Allowlist folder: Only allow commands from specific folder, not any path
  • Don't allow user input directly: Don't pass {comment} directly to command without sanitizing - could be command injection
  • Use wrapper scripts: Instead of directly executing with variables, call wrapper script that validates input
  • Run as normal user: Don't run as admin unless needed for hardware
  • Antivirus: Some antivirus may flag toolkit - add exception
  • Test offline: Always test command manually before linking to trigger
  • Cooldown: Set cooldown to prevent spam execution (e.g., 5 seconds)

Example safe wrapper batch:

@echo off
REM Only allow alphanumeric username
echo %1 | findstr /R "^[a-zA-Z0-9]*$" >nul
if errorlevel 1 exit /b
echo Safe user: %1 >> log.txt

Best Practices

  • Use absolute paths: C:\Full\Path\To\File.exe not relative
  • Quote paths with spaces: "C:\My Folder\app.exe"
  • Log: Make commands log to file for debugging
  • Error handling: Scripts should handle errors gracefully
  • Timeout: Commands should finish quickly (less than 5 seconds) or run async
  • Backup: Backup your scripts

Troubleshooting

  • Not executing?
    • Check Windows Toolkit running and Run Command enabled
    • Check command path exists and executable
    • Check allowed folder setting includes your command path
    • Try running command manually in CMD to see error
    • Check toolkit logs
  • Permission denied?
    • Try Run as Administrator in toolkit settings
    • Check file permissions
    • Check antivirus blocking

Related: Input Binding for game control, Actions for creating run command actions.


On this page