1.

Solve : Another question =) About viewing text files from batch?

Answer»

In my batch program I want to be able to view a text file. Is there a way to do that besides edit? (I want to view the file inside the batch file while its RUNNING)Code: [Select]type /?
Code: [Select]type "filename"
If you want to read it screen by screen try:

Code: [Select]type "filename" | moreThanks! Type is the last command I would've looked at for this lol. using this code, can I make a batch that creates setup.inf and it will set variables in it, and then use type to read them. I want like this:

Code: [Select]@echo off
echo set a=The Letter A>Text.inf
type Text.inf
echo %a%
pause
I want it to make the external variables in the .inf file and then read themwhy don't you try it and see?
yeah i did try it and it didnt workCould you explain a bit more clearly what it is that you want to do. As FAR as I can see, this is what you have...

1. You made a batch that creates a file called Text.inf.

This file, Text.inf, contains a line:

set a=The Letter A

2. You TYPE the file. That is, you get the file listed on screen. So far so good.

3. What are you expecting to happen? Are you expecting the variable %a% to be set to some value? Would that value be a string, "The Letter A"? Why do you think showing the file on screen will set the variable?





Well if I think I know what he's trying to do it can be achieved like this:

Quote


@echo off

::write something to file
>"testfile.txt" echo testvar

::set var to contents of text file
set /p var=<"testfile.txt"

::echo output of new var
echo %var%
pause
yeah its like this but i need to be able to make more than one variable in the testfileQuote from: gamerx365 on August 22, 2007, 07:17:57 AM
yeah its like this but i need to be able to make more than one variable in the testfile

type FOR /? at the prompt, and surf through all the many many posts on this forum about processing text files.

[sarcasm]
Or did you want a batch file written for you?
[/sarcasm]

YEA use for and a couple of temporary variables, I'll give you a hint, but I'm not WRITING this it's easy enough to do what contrex said and figure it out yourself:

Quote

... do (set %%A=%%B)



Discussion

No Comment Found