Loan | Problem Mortgage | Online Loans | Credit Card Debt Consolidation | Mobile Phone
dos batch [Archive] - PCMech Forums

PDA

View Full Version : dos batch


shane254
01-03-2001, 11:29 AM
I am trying to compile a small program that will open a text file and edit it and them close it
I am doing all of this in dos and I am wanting to build a batch file to do so

I just cant figure out how to make it edit the file

mosquito
01-03-2001, 11:34 AM
What do you mean with edit?

If you mean append, you can use

type some text to append >>test.txt


If not, you have some serious coding to do, its probably easier to look on the web for a tool to do it.

shane254
01-03-2001, 12:08 PM
I am trying to open a text file and edit it all in one batch file


like open a text file and tell it to add somde text to the file and the close it is there any way of doing this

mosquito
01-04-2001, 02:35 AM
the command posted above does this.

when you make a batch file with:

@echo off
type blablabla >>test.txt
type blablabla >>test.txt

you will see two lines with blablabla in the "test.txt" file. If you want to append text to a file use ">>" If you want to create a new file (or replace a file) use ">" to pipe the text in.

If you want for example the directory listing in a file you can use

@echo off
dir >> test.txt


now the directory listing of the current directory will be appended to the file.

If you want to see the list of commands you can use in a batch file, type "help" in a dos box. If you want to have info about a specific command, type "help <command>".

I can recommend this book for shell scripting (be carefull, it's about windows NT shell scripting. This is not the same as shell scripts on Win9x) http://www.newriders.com/books/title.cfm?isbn=1578700477


[Edited by mosquito on 01-04-2001 at 03:38 AM]