Home > Blockchain >  PowerShell console in Visual Studio Code: How to copy-paste?
PowerShell console in Visual Studio Code: How to copy-paste?

Time:03-14

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.

CodePudding user response:

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.

  • Related