How to usee type and find instead of echo

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Zia-ur-Rehman
Posts: 1
Joined: 07 May 2017 02:13

How to usee type and find instead of echo

#1 Post by Zia-ur-Rehman » 07 May 2017 02:27

Can som one tell me how this works

Code: Select all

Type %0 | Find "    " | Find "A Z" >> C:\example.text
:output
    Heloo
      How r u
Exit /b
Last edited by aGerman on 07 May 2017 10:43, edited 1 time in total.
Reason: code tags added in order to see line indentations

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

Re: How to usee type and find instead of echo

#2 Post by penpen » 07 May 2017 04:50

What result do you get?
What is the name of the batch file? (Example: "batch file.cmd".)
How do you call it? (Per doubleclick or do you use the cmd shell; in last case please with the full copy pasted screen.)

Or might i misunderstand what you are writing, and you only want to know a way to do output in a batch file?

Sidenote: Please use [code]sample code[/code] tags:

Code: Select all

sample code


penpen

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to usee type and find instead of echo

#3 Post by aGerman » 07 May 2017 10:52

I guess you want to do something like that:

Code: Select all

@echo off
:: FINDSTR is searching for (at least) four spaces at the beginning of the line in this script file. The output will be redirected to "example.txt".
findstr /bc:"    " "%~f0" >"example.txt"

:: EXIT /B quits the batch execution. Following lines were never seen by the command interpreter.
exit /b

    Hello
      How r u

Steffen

Post Reply