Search code examples
batch-filefindstr

findstr command without the new line (the Enter keys)


I need to use findstr command without new line.

My file "prova.txt" contains:

La#
Do#
Fa#

My batch file contains:

@echo off
FINDSTR Do# prova.txt

The result of command is:

Do#
//second empty line

Instead I wish it was:

Do#

How do I get this?

I Explain better:

I don't want the new line (the Enter keys) after the findstr command.


Solution

  • I don't anderstand what you're trying to do. But try like this :

    @echo off
    
    for /f "delims=" %%a in ('FINDSTR "Do#" "prova.txt"') do echo|set /p="%%a"
    echo.