8000 Forward command line arguments for console launchers by firai · Pull Request #1569 · winpython/winpython · GitHub
[go: up one dir, main page]

Skip to content

Forward command line arguments for console launchers #1569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Forward command line arguments in console launcher
  • Loading branch information
firai authored Apr 25, 2025
commit 5a8a70ce09835c7c5c937d33a3b2fe0a61fbda14
11 changes: 11 additions & 0 deletions portable/launchers_src/launcher_template_CONSOLE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ int main() {
std::wstring exeDir = exePath;
exeDir = exeDir.substr(0, exeDir.find_last_of(L"\\/"));

// Get command line string
LPWSTR commandLine = GetCommandLineW();
// Find first space to skip the current executable name
LPWSTR args = wcschr(commandLine, L' ');

// Define the path to the "scripts" directory
std::wstring scriptsDir = exeDir + L"\\scripts";

Expand All @@ -40,6 +45,12 @@ int main() {
// Define the command to run
std::wstring target = L"cmd.exe /c \"" LAUNCH_TARGET L"\"";

// Append arguments if present
if (args) {
target += L" ";
target += args;
}

// Configure the process startup info
STARTUPINFO si = { sizeof(si) };
si.dwFlags = STARTF_USESHOWWINDOW; // Prevent the window from appearing
Expand Down
0