Login Page - Create Account

Support Board


Date/Time: Tue, 01 Apr 2025 06:19:47 +0000



Post From: Run Program When This Alert Triggered: cmd.exe disrupts windows

[2025-03-27 23:39:01]
User719512 - Posts: 307
Just add them to the command line you build for your own CreateProcess call. Grok, or ChatGPT, can help you a lot here.


// Function to quote an argument if it contains spaces
std::wstring quoteArg(const std::wstring& arg) {
if (arg.find(L" ") != std::wstring::npos && arg[0] != L'"') {
return L"\"" + arg + L"\""; // Add quotes if spaces exist and not already quoted
}
return arg; // Return as-is if no spaces or already quoted
}

int wmain(int argc, wchar_t* argv[]) {
...
// Append Sierra Chart arguments (skip argv[0] and optional config path)
int startArg = 1;
for (int i = startArg; i < argc; ++i) {
commandLine += L" ";
commandLine += quoteArg(argv[i]); // Quote args with spaces
}


With this, you can call python.exe with a script and pass the args to said script as part of the command line.