Batch file help

Get help on programming - C++, Java, Delphi, etc.
Post Reply
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Batch file help

Post by DarkRanger »

Hi guys,

I want to write a batch file to add text into a text file.

I do not have the slightest idea on how to start with a batch file. This is not homework, this is a little side project I am doing.

I know the patch to the text file, and I know the lines that I need to add to it. I want to use this program, to add these lines to all our work PC's.

Thanks!!
Image
User avatar
rustypup
Registered User
Posts: 8872
Joined: 13 Dec 2004, 02:00
Location: nullus pixius demonica
Contact:

Re: Batch file help

Post by rustypup »

Code: Select all

echo my test sentence > target.txt  //will create a new file with echo's contents
echo my test sentence >> target.txt  //will append a new line with echo's contents
generally my first stop when contemplating going this route...
Most people would sooner die than think; in fact, they do so - Bertrand Russel
SBSP
Registered User
Posts: 3124
Joined: 09 May 2006, 02:00
Location: Centurion

Re: Batch file help

Post by SBSP »

I do not have the slightest idea on how to start with a batch file.
Open Notepad.

Then paste what Rustypup posted.

Code: Select all

echo my test sentence > target.txt  //will create a new file with echo's contents
echo my test sentence >> target.txt  //will append a new line with echo's contents
Then save it with extention .Bat (E.G Run.bat)
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: Batch file help

Post by DarkRanger »

Thanks, fixed it! ;)
Image
Post Reply