How to remove newlines from a text file with batch or PowerShell
问题 Essentially, I want to read from file.txt with contents apple banana carrot and write to newfile.txt so that it will have contents apple banana carrot I need to do this on a Windows computer on which I do not have install permissions. I tried set row= for /f %%x in (file.txt) do set row=%row% %%x echo row > newfile.txt and I tried using PowerShell statements (I cannot run PowerShell scripts) instead of the CMD-style for loop. powershell -Command "(Gc file.txt) | Foreach-Object -Process {set