I can't speak for if TriggerCMD has that functionality, but I had to do that once to send commands to a Minecraft server window. I Googled around and found C# code that will send text to an existing command window. Here is the code:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text;
namespace SendToCMD {
static class Program {
[DllImport("user32")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EnumChildWindows(IntPtr window, EnumWindowProc callback, IntPtr i);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern int GetClassName(IntPtr hWnd, System.Text.StringBuilder lpClassName, int nMaxCount);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
static IntPtr hWnd = FindWindow(null, "Untitled - Notepad");
[DllImport("user32.dll", SetLastError = true)]
static extern bool PostMessage(IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] uint Msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", SetLastError = true)]
static extern bool PostMessage(IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] uint Msg, int wParam, int lParam);
const int WM_KEYDOWN = 0x0100;
const int WM_KEYUP = 0x0101;
const int WM_CHAR = 0x0102;
public static IntPtr cmdHwnd = IntPtr.Zero;
[STAThread]
static void Main(string[] args) {
if (args.Length < 2) Environment.Exit(1);
string windowToAttach = args[0];
string commandToSend = String.Join(" ", args, 1, args.Length-1);
IntPtr child = FindWindow(null, windowToAttach);
StringBuilder sb = new StringBuilder(100);
if (child.ToString() == "0") return;
GetClassName(child, sb, sb.Capacity);
if (sb.ToString() != "ConsoleWindowClass") return;
uint wparam = 0 << 29 | 0;
string msg = commandToSend;
int i = 0;
for (i = 0; i < msg.Length; i++) PostMessage(child, WM_CHAR, (int)msg[i], 0);
PostMessage(child, WM_KEYDOWN, (IntPtr)Keys.Enter, (IntPtr)wparam);
cmdHwnd = child;
}
public static List<IntPtr> GetChildWindows(IntPtr parent) {
List<IntPtr> result = new List<IntPtr>();
GCHandle listHandle = GCHandle.Alloc(result);
try {
EnumWindowProc childProc = new EnumWindowProc(EnumWindow);
EnumChildWindows(parent, childProc, GCHandle.ToIntPtr(listHandle));
} finally {
if (listHandle.IsAllocated)
listHandle.Free();
}
return result;
}
private static bool EnumWindow(IntPtr handle, IntPtr pointer) {
GCHandle gch = GCHandle.FromIntPtr(pointer);
List<IntPtr> list = gch.Target as List<IntPtr>;
if (list == null) {
throw new InvalidCastException("GCHandle Target could not be cast as List<IntPtr>");
}
list.Add(handle);
return true;
}
public delegate bool EnumWindowProc(IntPtr hWnd, IntPtr parameter);
}
}
If you aren't familiar with C#, here is the compiled version if you want to try it. You just need to pass it the window title then whatever commands you want it to run. Like on my MC server I have a batch file like:
@echo off
setlocal
set windowTitle="Spigot 1.16.4"
sendtocmd %windowTitle% time set 1200 imperial
sendtocmd %windowTitle% mgctrl spleef reset
sendtocmd %windowTitle% mgctrl spleef annc Spleef arena reset, ready for next game!