From d88fb55d7b306142b93f7fc59ea106f83801dfb2 Mon Sep 17 00:00:00 2001 From: zzahkaboom24 Date: Mon, 17 Aug 2026 22:41:25 +0200 Subject: [PATCH] [cli] Add flag to close console immediately on launch Adds a --hidden flag to the legendary launch command that closes the console upon a game's launch, restoring the way it worked from version 0.20.34 "Direct Intervention" and lower, while keeping the default as visible as is with 0.21.0 "Lowlife". --- legendary/cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/legendary/cli.py b/legendary/cli.py index 158e5aa..7f4a835 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -738,7 +738,9 @@ class LegendaryCLI: if params.environment: logger.debug('Environment overrides: {}'.format(', '.join( f'{k}={v}' for k, v in params.environment.items()))) - subprocess.Popen(full_params, cwd=params.working_directory, env=full_env, shell=os.name == 'nt') + subprocess.Popen(full_params, cwd=params.working_directory, env=full_env, + shell=os.name == 'nt', + creationflags=subprocess.CREATE_NO_WINDOW if os.name == 'nt' and args.hidden else 0) def _launch_third_party(self, args): game = self.core.get_game(app_name=args.app_name) @@ -2917,6 +2919,8 @@ def main(): help='Launch Ubisoft to install and run the game.') launch_parser.add_argument('--json', dest='json', action='store_true', help='Print launch information as JSON and exit') + launch_parser.add_argument('--hidden', dest='hidden', action='store_true', + help='Hide the console for the launched game on Windows') if os.name != 'nt': launch_parser.add_argument('--wine', dest='wine_bin', action='store', metavar='',