diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs index cbce5c675dc..0652b325344 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs @@ -394,6 +394,10 @@ private void ShowHelp() Dbg.Assert(_helpText != null, "_helpText should not be null"); _hostUI.WriteLine(""); _hostUI.Write(_helpText); + if (_showExtendedHelp) + { + _hostUI.Write(ManagedEntranceStrings.ExtendedHelp); + } _hostUI.WriteLine(""); } @@ -536,6 +540,7 @@ private void ParseHelper(string[] args) else if (MatchSwitch(switchKey, "help", "h") || MatchSwitch(switchKey, "?", "?")) { _showHelp = true; + _showExtendedHelp = true; _abortStartup = true; } else if (MatchSwitch(switchKey, "noexit", "noe")) @@ -955,7 +960,7 @@ bool TryGetBoolValue(string arg, out bool boolValue) } WriteCommandLineError( string.Format(CultureInfo.CurrentCulture, CommandLineParameterParserStrings.ArgumentFileDoesNotExist, args[i]), - showBanner: false); + showHelp: true); return false; } @@ -1164,6 +1169,7 @@ private bool CollectArgs(string[] args, ref int i) private string _configurationName; private PSHostUserInterface _hostUI; private bool _showHelp; + private bool _showExtendedHelp; private bool _showBanner = true; private bool _noInteractive; private string _bannerText; diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs index c8e233c20fb..b82b277b7bc 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs @@ -74,7 +74,7 @@ public static int Start(string consoleFilePath, [MarshalAs(UnmanagedType.LPArray var formattedBanner = string.Format(CultureInfo.InvariantCulture, banner, PSVersionInfo.GitCommitId); exitCode = Microsoft.PowerShell.ConsoleShell.Start( formattedBanner, - ManagedEntranceStrings.ShellHelp, + ManagedEntranceStrings.UsageHelp, args); } catch (System.Management.Automation.Host.HostException e) diff --git a/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx b/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx index 46e84767cb0..8bef56e8c24 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx +++ b/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx @@ -124,7 +124,7 @@ Copyright (c) Microsoft Corporation. All rights reserved. https://aka.ms/pscore6-docs Type 'help' to get help. - + Usage: pwsh[.exe] [[-File] <filePath> [args]] [-Command { - | <script-block> [-args <arg-array>] | <string> [<CommandParameters>] } ] @@ -137,7 +137,10 @@ Type 'help' to get help. PowerShell Online Help https://aka.ms/pscore6-docs -All parameters are case-insensitive. +All parameters are case-insensitive. + + + -Command | -c Executes the specified commands (and any parameters) as though they were typed