sralse
sralse

Reputation: 5

Display file contents

I am trying to display a full textfile in a batch file, but when I do it like this, it opens notepad.

@echo off
call YourText.txt
pause >nul
exit

I also tried

@echo off
more < YourText.txt
pause >nul
exit

Both with double quotes, and without. However, it doesn't work. Then, when I did it without @echo off it works, but it will display each line as:

C:\Documents and Settings\Gebruiker\Mijn documenten\others\Bureaublad YourTextline 1
C:\Documents and Settings\Gebruiker\Mijn documenten\others\Bureaublad YourTextline 2

I already tried the set /f command without any luck. Does anybody know how to import a full text file through a batch file?

Upvotes: 1

Views: 300

Answers (1)

Ken White
Ken White

Reputation: 125651

You're looking for type:

type YourFile.txt

If you want it to pause between screens full of text, combine it with more using the pipe | operator:

type YourFile.txt | more

or using more directly getting input from the text file or via redirection (first example courtesy of @MatthewStrawbridge in his comment):

more YourFile.txt

or

more < YourFile.txt

Upvotes: 5

Related Questions