Getting a .txt file to display using autoexec.bat? Need help

Ghost

Senior member
Dec 13, 1999
297
1
81
Was reading a book that mentions how to display a text file by having it launched from the autoexec.bat file. I'm not sure if this will display during the boot process, or immediately when Windows loads.

I'm unfamiliar with this and was looking for some help. I tried it and couldn't get it to work.

The book says "simply save a text file to the hard drive..." and then it says "add the line "notepad c:\myfile.txt (where myfile.txt is whatever you call it) to the end of the autoexec.bat file."

I created a short file named test.txt in notepad. I saved it to mydocuments. I ran msconfig and added this line to the end of the autoexec.bat file. "Notepad C:\test.txt"

First try, I included the quotes. Second try I removed them. Third try I just had it as C:\test.txt. Neither of the above attempts worked.

I know this is a little silly, but I'm curious.

Thanks in advance

Ghost
 

hominid skull

Senior member
Nov 13, 1999
971
0
0
I'm not 100% sure what you want to do but i think that you want to display some information during bootup of the machine, why else would you want it in the autoexec.bat file..

One way to do it is not with notepad, but with echo commands in the batch file itself..

I.E. In autoexec.bat file pu the line:

call test.bat

In test.bat type:
echo (then text you want displayed)
echo (next line of text you want displayed)

and so on..

If on the other hand you want to displat a text file when windows has loaded you can display it with notepad, here's how..

Right click notepad in the start menu and drag it to the desktop and select 'create shotcut here'

Right click on the new shortcut and select properties, In Target type C:\WINDOWS\NOTEPAD.EXE test.txt (what ever the file is called)
and in start in put the directory that the file you want to display is.

Ok it and the shortcut is done, the only thing else to do is put it in the startup folder on the start menu, you can do this by draging the shortcut to the start menu, programs, startup. all done..

I hope this helps..







 

Ghost

Senior member
Dec 13, 1999
297
1
81
Can you please explain in a little more detail, claw?

What does the command "more" actually do?

Thanks
 

claw

Senior member
Jan 13, 2000
543
0
0
more will display the contents of the text file you specify. If the contents exceed a screenful, it'll pause and will display the rest when you press a key.

Open up a command prompt and you can try it out. Just type:
more [filename]
and it will display the filename you specify.

You can also pipe output into more, but that's a bit more complicated to explain if you're not familiar with DOS input/output redirection. If you really want to know, then I can provide a more detailed discussion.
 

Ghost

Senior member
Dec 13, 1999
297
1
81
Okay. I added "more test.txt" as the last line in my autoexec.bat file without the quotes.

test.txt is a small file created in notepad and saved in the mydocuments directory.

When I rebooted my machine it said "more test.txt invalid file name in command line, and didn't work.

Sorry for my ignorance, but do I need to point it to "more \mydocuments\test.txt?
 

claw

Senior member
Jan 13, 2000
543
0
0
ok, if your text file is in C:\My Documents, then use,

more \mydocu~1\test.txt

(we need to use mydocu~1 since DOS won't support long filenames)
 

Ghost

Senior member
Dec 13, 1999
297
1
81
Thanks, claw, it worked. I sincerely appreciate your time.

Never heard of the "more" command.... and I was surfing dos commands earlier trying to figure out my problem. I'm wondering if you have a programming background?

Or maybe it's my ignorance of DOS.....

Thanks again,

Ghost
 

claw

Senior member
Jan 13, 2000
543
0
0
Sure no problem... I grew up with DOS, all the way since DOS 2.11... I even use the command prompt half the time in Win2K. :)

Anyway, if you're looking for a good MS-DOS reference, it's on your Windows 98 CD. Copy all the contents of X:\TOOLS\OLDMSDOS (where X is the CD-ROM drive with the Win98 CD) into C:\WINDOWS\COMMAND

One of those files is HELP, which provides a reference for all the DOS 6.22 commands (which is slightly different, but not too different, from those of Win98).

Just run help at the command prompt to see it after you've copied the files.
 

AndyHui

Administrator Emeritus<br>Elite Member<br>AT FAQ M
Oct 9, 1999
13,141
16
81
type can also do the same thing...eg

type mytext.txt, and if it goes for more than 1 page, you can pipe it through the more command:

type mytext.txt | more.