Computing.Net > Forums > Disk Operating System > read first line from text file

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

read first line from text file

Reply to Message Icon

Original Message
Name: expodium
Date: August 9, 2004 at 08:40:45 Pacific
Subject: read first line from text file
OS: W2000
CPU/Ram: 2400 / 512
Comment:

hi,

i try to write a batch file that have to run under dos 6.22 (thus, no for loops ;o))

I try to set the first line from a text file in to a variable but all i see is a example for under nt4 or w2000.

the first line is 00-00-ab-ff-d3-e2 (yep, a mac address)

i need it to create unique names for a dos network boot disk.

i try allready 2 weeks to find a good example but find only a lot of examples that dont work under dos 6.22

Why dos 6.22? well, i get my own tools that i use and only works under 6.22.

i really hope that someone can give me a good and easy example.

many many thanks in advance.

Regards,

Expodium

system admin


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: August 9, 2004 at 10:17:52 Pacific
Reply: (edit)

Hi,

1. If you want to label the boot disk 00-00-ab-ff-d3-e2, you're put of luck, because it's too long.

2. Are you willing to use third party uillities or do you want to use strictly DOS 6.22?

M2

Mechanix2Go@Golden-Triangle.com



Report Offensive Follow Up For Removal

Response Number 2
Name: expodium
Date: August 9, 2004 at 23:44:27 Pacific
Reply: (edit)

ik need it for a computername. Not for using as a label.

and yes, strict dos 6.22 and a thirt part tool to get the mac address.

thanks anyway

expodium

system admin


Report Offensive Follow Up For Removal

Response Number 3
Name: IVO
Date: August 10, 2004 at 02:08:02 Pacific
Reply: (edit)

To get thew first line of a text file into a variable under DOS 6.22 see FAQ #25 at

www.batchfiles.co.nr

but pay attention the script requires to run Debug, so you have to put it onto your diskette reducing the available space.


Report Offensive Follow Up For Removal

Response Number 4
Name: Mechanix2Go
Date: August 10, 2004 at 02:12:40 Pacific
Reply: (edit)

Hi,
This will take your file and cut off the first 6 chars and put the last 11 into a variable called L.

It can be modified to put all 17 chars.

############
@echo off > quit.bat
@echo echo %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 >> quit.bat


if %1'==' quit which file?
if not exist %1 quit file %1 is not here
debug /? > nul
if errorlevel 1 quit this needs debug to work

:start

> %1.d type nul
>> %1.d echo f 100 200 0
>> %1.d echo n %1
>> %1.d echo l
>> %1.d echo n %1.bat
>> %1.d echo e 100 "set L="
>> %1.d echo w
>> %1.d echo q
>> %1.d echo.

debug < %1.d > nul

del %1.d
for %%C in (call del) do %%C %1.bat

:end
#############

Let us know.

M2

Mechanix2Go@Golden-Triangle.com



Report Offensive Follow Up For Removal







Post Locked

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


Go to Disk Operating System Forum Home








Do you have a Desktop Computer anymore?

No
Yes, but only at work
Yes, but its rarely used
Yes, and its a workhorse


View Results

Poll Finishes Today.
Discuss in The Lounge
Poll History




Data Recovery Software