"more" command broken?

I need to use something like

type foobar.txt | more /P >convert.txt

using CMD there is a “to many arguments”-Error

using PS there is an error too

  •     Get-Content $file | more.com
    
  •     ~~~~~~~~~~~~~~~~~
    
  • CategoryInfo : ObjectNotFound: (G:\p:String) [Get-Content], ItemNotFoundException
  • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

I need to use /P to convert unix-style text to windows-style test.

more in PowerShell is not more.com, it is a function which is uses more.com without any parameter.

You could do,

# To see what is in more function
${Function:more}

# What you can do instead
Get-Content foobar.txt | C:\Windows\System32\more.com /P

Does MORE under PS less than more.com?

I only tried PS, because of more.com gave me an error “too many arguments” if I use the switch “/P” … And maybe you can xcheck if more.com works with “/P” at your computer?

 

PS C:\xampp> Get-Content apache_start.bat
@echo off
cd /D %~dp0
echo Diese Eingabeforderung nicht waehrend des Running beenden
echo Bitte erst bei einem gewollten Shutdown schliessen
echo Please close this command only for Shutdown
echo Apache 2 is starting …

apache\bin\httpd.exe

if errorlevel 255 goto finish
if errorlevel 1 goto error
goto finish

:error
echo.
echo Apache konnte nicht gestartet werden
echo Apache could not be started
pause

:finish

PS C:\xampp> Get-Content apache_start.bat | C:\Windows\System32\more.com /P
Zu viele Angaben in der Befehlszeile. -> Translates to: Too much information in the command line.
PS C:\xampp>

Either you translate the console output to english or you may better off in the German Powershell forum with this question. Sometimes it’s easier to ask a question in your native language.
What is it what you actually want to achieve? Powershell is able to replace cdm completely. There’s actually no need anymore for “old” and pretty much obsolete cmd commands. Did you try :

Get-Content -Path “apache_start.bat” | Out-File -FilePath “convert.txt”

If you’re not satified with the result you can try the many options (parameters) the Powershell cmdlets provide for you.

MORE /P should convert the Linux line feed to a typical Windows one with CR/LF.

“type in.txt | more /p >out.txt” is the line. It worked the last time I had to edit the firmware.

I need this to run patch scripts for a firmware under Windows that has been made for Linux. Normally the update script does this automatically with the MORE command.

And now it just doesn’t work anymore. When I call more.com in the CMD or PS, an error occurs. Probably best translated with “too many parameters…” or “too many arguments, in command line”.

I’d like to know if the command with the parameter “/P” doesn’t work for you as well?

English is no problem and the English community is much bigger.

OK. If you think it will help you to know if the command works on my machine:

type C:\sample\data.txt | more /p > C:\sample\out1.txt

type C:\sample\data.txt | C:\Windows\System32\more.com /p > C:\sample\out2.txt


Both command lines wok on my machine without any error. :wink:
Windows 10 1803 , PS version 5.1.17134.228.

If you want to convert unix to windows text in powershell, this should work (running in windows):

get-content unix.txt | set-content windows.txt

I don’t recommending using “>” or “out-file” in powershell 5. You’ll end up with a file in utf-16 or “unicode” encoding.

Hmmm? Not sure the best way to do this. Don’t do it twice.

(Get-Content -raw unix.txt) -replace "`n","`r`n" | set-content windows.txt

In fact, it seems to be a bug from Microsoft.
I have several computers with the same software version.
On some computers it runs as before and on others you have to activate the advanced functions of MORE with the /E switch to be able to use /P.

This has probably nothing to do with the Powershell, but a forum exlizit for the command line I did not find :wink: Thanks for your thoughts.

You could give the Windows 10 General forum a try or you could think about using a pure Powershell solution.