Skip to content

Conversation

@drcxd
Copy link
Contributor

@drcxd drcxd commented Nov 26, 2025

  • pwsh/Microsoft.PowerShell_profile.ps1 (Function): Only set several PSReadline options when PowerShell is used interactively.
        Set-PSReadLineOption -PredictionViewStyle ListView
        Set-PSReadlineKeyHandler -Key Escape -Function Undo

generates error messages when I call some PowerShell script in Emacs with

(async-shell-command "pwsh.exe script.ps1")

The error messages are like:

Set-PSReadLineOption: C:\Users\Administrator\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:44
Line |
  44 |    Set-PSReadLineOption -PredictionViewStyle ListView
     |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The handle is invalid.

* pwsh/Microsoft.PowerShell_profile.ps1 (Function): Only set several
PSReadline options when PowerShell is used interactively.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant