Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Okay, I was doing some simple batch
programming, and experienced the need
to somehow get the first line of some
files (I have a directory of files, and the
files contain the path to another file in
their contents as the first and only line)
into some usable form such as an
environment variable.
However, I have no idea as to how to do
this... I tried a couple things involving
redirection and pipes, as well as CON,
but none of them worked.
So, simply stated, could I redirect
something's output to an environment
variable instead of a file?I guess that would not be required, and
there are probably other ways of doing it...
it would just enable to me to do what I'm
trying to do - which is view the contents of
a file which the path of is specified in
another file... and I need to integrate that
into a batch file - like I said, I have a
directory full of files that have the path to
another file in their contents. A file is
specified on the command line of the
batch file... and it needs to view the file
specified in that file's contents. I believe
I've stated that point enough now.Thanks,
-Chris

Hi Chris. Laurence Soucy did post the following script a couple of days ago (snipped script):
@ECHO off
:: ASCII Assembler by Laura Fairhead
ECHO XPYP[*'CC-\1P\QX,=P,APZ5O!PQ2O~5aaI~}Ksx>%temp%.\echos.comECHOS.COM will echo a string without CR/LF character on the end. So, use it like this:
@ECHO off
:: ASCII Assembler by Laura Fairhead
ECHO XPYP[*'CC-\1P\QX,=P,APZ5O!PQ2O~5aaI~}Ksx>%temp%.\echos.com
%temp%.\echos.com SET VAR=> %temp%.\temp.bat
type filename.ext >> %temp%.\temp.bat
call %temp%.\temp.bat
del %temp%.\echos.com
del %temp%.\temp.batWatch out for line wrapping. FILENAME.EXT is the file which has the string to be sent to %VAR%.
This script actually gets the text into FILENAME.EXT, inputs a prefix on it ("SET VAR="), send to a batch file and runs it.
-- Secret_Doom - Leonardo Pignataro --
PS: Hey Laurence, that ASCII code is very useful, I must say!
secret_doom@hotmail.com
www.batch.hpg.com.br

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |