wsl commands result in lines with carriage returns #2526

Closed
opened 2026-01-30 22:57:27 +00:00 by claunia · 1 comment
Owner

Originally created by @maharris77 on GitHub (Jul 3, 2019).

From PowerShell, running

wsl cat file1 > file2
wsl echo text3 > file2

results in a file2 with carriage returns. If I am inside WSL-Ubuntu and run the commands (without wsl), the resulting file does not have carriage returns, which is the desired behavior.

Originally created by @maharris77 on GitHub (Jul 3, 2019). From PowerShell, running ``` wsl cat file1 > file2 wsl echo text3 > file2 ``` results in a file2 with carriage returns. If I am inside WSL-Ubuntu and run the commands (without `wsl`), the resulting file does not have carriage returns, which is the desired behavior.
claunia added the Needs-TriageResolution-ExternalNeeds-Tag-FixProduct-Powershell labels 2026-01-30 22:57:27 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Jul 3, 2019):

This is because of how powershell handles piping from "native commands". When you use wsl cat ... > file2, cat is running inside wsl, but > file2 is being handled by powershell.

File an issue over at the powershell repository!

@DHowett-MSFT commented on GitHub (Jul 3, 2019): This is because of how powershell handles piping from "native commands". When you use `wsl cat ... > file2`, `cat` is running inside wsl, but `> file2` is being handled by powershell. File an issue over at [the powershell repository](https://github.com/powershell/powershell)!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#2526