You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mention the quasi-interactive, REPL-like behavior of -File - and -Command - and a workaround #11098
It is reasonable for users - especially those familiar with POSIX-compatible shells such as Bash - to expect -File - to treat its stdin input as a whole as if it were the content of a script file. -Command - does not have a POSIX-compatible shell counterpart, but the expectation applies analogously.
Unfortunately, both -File - and -Command - exhibit quasi-interactive behavior that seems to be geared toward supporting REPL-like functionality via stdin: see PowerShell/PowerShell#21808 (comment) for a summary.
To get the expected behavior, the following workaround is currently required, which is worth mentioning:
Enclose the code in & { ... }
Ensure that it is terminated by two trailing newlines.
changed the title [-]Mention the quasi-interactive, REPL-like behavior of `-File -` and `-Command -`[/-][+]Mention the quasi-interactive, REPL-like behavior of `-File -` and `-Command -` and a workaround[/+]on May 10, 2024
Activity
[-]Mention the quasi-interactive, REPL-like behavior of `-File -` and `-Command -`[/-][+]Mention the quasi-interactive, REPL-like behavior of `-File -` and `-Command -` and a workaround[/+]Fixes #11098 - REPL behavior only applies to standard input scenarios (…