Powershell command line command prints ^ C when pressing Ctrl + C, why?

My command shell of choice is Powershell, I always have a couple of windows where I run my scripts.

I noticed that at some point the shell starts behaving in a very annoying way:

  • Press the key - nothing is displayed! Press another one - it works fine and the rest of the keys are processed as expected until you press Enter to execute. The command is run, a new command line appears and again the first key is ignored!
  • Pressing Ctrl + C displays ^ C instead of canceling the current prompt and displaying a new one.

The strangest thing is that the shell starts working fine, runs for a while, then fails along the aforementioned path, and then returns back to work after a period of time.

This is very confusing, I had a bad shell instance when I started this question, but now everything is fine.

Has anyone come across a similar one? What could be causing this?

EDIT

I am using the console shell exclusively, not ISE. Shortcut command:

%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe

      

Shell version:

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      3.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.34209
BuildVersion                   6.2.9200.17065
PSCompatibleVersions           {1.0, 2.0, 3.0}
PSRemotingProtocolVersion      2.2

      

By the way, he's spoiled again!

EDIT

The problem persisted. The power section breaks down almost every day. For example, now. Checked [Console]::TreatControlCAsInput

- it is True

!!! Re-read it a couple of minutes later - again False

!!! And now Ctrl + C works as expected again.

What's happening?

+1


source to share


1 answer


As for the second question about Ctrl + C, you should try Ctrl + Shift + C or Ctrl + X to cancel the current prompt



0


source







All Articles