Reputation: 9393
type file.txt > file2.txt \\ sends the file.txt contains to file2.txt
Suppose if the file name is stored in file2.txt How do i send it to type command? How do i open the file contents of it. If the file name is stored in file2.txt?
type >file2.txt to open it? \\ its not working says incorrect syntax
I tried it in many ways.Can anyone help me ?
Upvotes: 0
Views: 600
Reputation: 67216
In most programming languages there are several ways to do the same things. I always thought that the easier/simpler one is the best one:
set /P VAR=< file.txt
type %VAR%
Regards...
Antonio
Upvotes: 2
Reputation: 10662
for /f "usebackq" %I IN (`type file.txt`) DO set VAR=%I
type %VAR%
Upvotes: 2
Reputation: 41625
You should try:
type file2.txt
Or if you want to combine come commands:
find "2011-07" logfile.txt | type
Or, if these are not what you want, maybe it is this:
file2.txt
contains a filename (probably from a previous dir
command). How can I open that file? – but sadly, I don't know the answer to this question.
Update: try this:
for /F %F in (file2.txt) do type %F
Upvotes: 1