7

How can I disable right-click to paste in PowerShell?

From other programs I have a habit of right-clicking for context menu, and depending on the contents of the clipboard, in PowerShell this can be lethal.

2
  • You should edit your question to indicate which version of Windows you are using. The current answer only applies to Windows 10, and specific build of Windows 10, so knowing what version you are running is important.
    – Ramhound
    Aug 21 '18 at 11:27
  • @Ramhound it applies to any Windows and even cmd.exe
    – phuclv
    Aug 21 '18 at 11:37
9

This is a feature called QuickEdit of the console, not PowerShell. In previous versions of cmd it's turned off by default. It was claimed that Windows 10 turns it on by default but I'm not able to check since I've always had it enabled since Windows 7

To disable that feature just open the console menu, either by

  • right clicking on the console title bar
  • pressing Alt+Space
  • or left clicking on the title bar logo

then select Properties or Defaults depending on whether you want to set the options for that sessions or for all further execution. In the Options tab, Edit Options group uncheck the QuickEdit Mode

Now you can't paste by right click anymore but you also lose the ability to select text by mouse or by Shift+Arrow keys and must switch to mark mode by opening the context menu > Edit > Mark to select

PowerShell

In older cmd versions the location is a little bit different

cmd

See also What does it do exactly if I click in the window of cmd?

0

My solution: using AutoHotKey

#IfWinActive, ahk_exe powershell.exe
    RButton::return
#IfWinActive

And using run with UIA to ensure it working on admin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.