1

I cannot Copy-Paste from the Visual Studio Code console. In ISE one can copy-paste some of the output, but it does not seem to be possible in Visual Studio Code Terminal. How can I copy-paste the output from the console when running PowerShell commands? I have the PowerShell Extension.

mklement0
  • 382,024
  • 64
  • 607
  • 775
xhr489
  • 1,957
  • 13
  • 39
  • 1
    This should work fine by default. What particular methods for copying and pasting are you using, and what, specifically happens or doesn't happen? – mklement0 Mar 12 '22 at 21:18
  • 1
    @mklement0: I use the mourse and right clicking but the menu does not show. I have also tried to simply ctrl + c and see if I have the content in my clipboard but it does not work. – xhr489 Mar 12 '22 at 21:29
  • 1
    Right-clicking by itself should already copy selected text. If you prefer Ctrl+C (which by default interrupts the current command), have a look at [this Q&A](https://stackoverflow.com/q/45257525/7571258). – zett42 Mar 12 '22 at 21:31

1 Answers1

1

Ctrl+C and Ctrl+V for copying / pasting work as-is in Visual Studio Code's integrated terminal.

By contrast, right-click behavior is configurable:

  • On Windows, the default behavior is to copy, if text is currently selected, and paste otherwise - as in regular console windows.

  • To get the same behavior as in the Windows PowerShell ISE, i.e. to instead show a shortcut menu, which contains Copy and Paste commands, add the following line to your settings.json file (before the closing }):

"terminal.integrated.rightClickBehavior": "default",

Alternatively, use the settings GUI (press Ctrl+,):

right-click behavior setting

Note:

  • The screenshot was taken on macOS, where selectWord is the default setting; on Windows, it is copyPaste, with the behavior as described above.

  • Also note the GUI's convenient search feature: typing right click in the search field was sufficient to locate the relevant setting.

mklement0
  • 382,024
  • 64
  • 607
  • 775