Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ private void ParseHelper(string[] args)
{
_sshServerMode = true;
}
else if (MatchSwitch(switchKey, "interactive", "i"))
{
_noInteractive = false;
}
else if (MatchSwitch(switchKey, "configurationname", "config"))
{
++i;
Expand Down Expand Up @@ -801,7 +805,7 @@ private void ParseHelper(string[] args)
{
ParseFormat(args, ref i, ref _outFormat, CommandLineParameterParserStrings.MissingOutputFormatParameter);
}
else if (MatchSwitch(switchKey, "inputformat", "i") || MatchSwitch(switchKey, "if", "i"))
else if (MatchSwitch(switchKey, "inputformat", "in") || MatchSwitch(switchKey, "if", "if"))
{
ParseFormat(args, ref i, ref _inFormat, CommandLineParameterParserStrings.MissingInputFormatParameter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.</value>
</data>
<data name="ShellHelp" xml:space="preserve">
<value>PowerShell[.exe] [-PSConsoleFile &lt;file&gt; | -Version &lt;version&gt;]
[-NoLogo] [-NoExit] [-Sta] [-Mta] [-NoProfile] [-NonInteractive]
[-NoLogo] [-NoExit] [-Sta] [-Mta] [-NoProfile] [-NonInteractive] [-Interactive]
[-InputFormat {Text | XML}] [-OutputFormat {Text | XML}]
[-WindowStyle &lt;style&gt;] [-EncodedCommand &lt;Base64EncodedCommand&gt;]
[-ConfigurationName &lt;string&gt;]
Expand Down Expand Up @@ -164,6 +164,9 @@ PowerShell[.exe] -Help | -? | /?
-NonInteractive
Does not present an interactive prompt to the user.

-Interactive
Present an interactive prompt to the user.

-InputFormat
Describes the format of data sent to Windows PowerShell. Valid values are
"Text" (text strings) or "XML" (serialized CLIXML format).
Expand Down
9 changes: 7 additions & 2 deletions test/powershell/Host/ConsoleHost.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,13 @@ Describe "ConsoleHost unit tests" -tags "Feature" {
# All of the following tests replace the prompt (either via an initial command or interactively)
# so that we can read StandardOutput and reliably know exactly what the prompt is.

It "Interactive redirected input" {
$si = NewProcessStartInfo "-noprofile -nologo" -RedirectStdIn
It "Interactive redirected input" -TestCases @(
@{InteractiveSwitch = ""}
@{InteractiveSwitch = " -IntERactive"}
@{InteractiveSwitch = " -i"}
) {
param($interactiveSwitch)
$si = NewProcessStartInfo "-noprofile -nologo$interactiveSwitch" -RedirectStdIn
$process = RunPowerShell $si
$process.StandardInput.Write("`$function:prompt = { 'PS> ' }`n")
$null = $process.StandardOutput.ReadLine()
Expand Down