On wsl1, getting clipboard contents using powerhshell changes terminal appearance…?
I posted this on stack (now deleted), but was told that this might be a more appropriate forum.
I'm on windows-subsystem-linux 1 with Ubuntu with the Windows Ubuntu terminal.
Using advice from this post: https://stackoverflow.com/questions/17819814/how-can-you-get-the-clipboard-contents-with-a-windows-command
I'm calling powershell to output the contents of the clipboard to a file, as in:
powershell.exe -command "Get-Clipboard" > myFile.txt
This completely changes the appearance of my terminal and I think I might be running powershell, or something. See "before" and "after redirecting to a file", below. It also truncates my terminal after about ~3/4 of the screen.
You'll note that the window description now says "powershell.exe". But I can still run linux commands, and I have access to functions and aliases defined in my bashrc, so it's not like I'm suddenly in a powershell environment.
What's odd is that if I run, powershell.exe -command "Get-Clipboard"
(ie without redirecting) it outputs the clipboard contents to the terminal without affecting my terminal appearance.
Typing ctrl-c
does nothing. ctrl-d
or typing exit
just kills the terminal.
Any ideas about what's going on?
Before:
After redirecting to the terminal:
After redirecting to a file:
Solution 1:
Based on the comments and our testing, this seems to be a problem with the "Ubuntu terminal" (the terminal launched with the Ubuntu WSL distribution from the Windows Start menu). Other terminals such as hyper.js, Windows Terminal (from Microsoft, in the Store), and the default Windows terminal (launched when you use the "bash" command from the Start menu) all seem to work correctly.
Recommendation - Install an alternate terminal. My personal preference is Windows Terminal.