Windows macro for appending to files - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Microsoft Windows and Software
Click Here to Login
Closed Thread
 
Thread Tools Display Modes
 
Old 06-03-2010, 10:02 AM   #1 (permalink)
Newb Techie
 
Join Date: May 2010
Posts: 10
Default Windows macro for appending to files

Hello,

For the task I'm currently working on, I often find myself typing the following line at the command prompt:

> echo "some_string" >> filename.txt

with the desired result being "some_string" appended to the end of the file. The thing is, I am always appending to the same file, so it would be convenient for me to have a doskey macro to cut down on the typing. Here's what I tried:

> doskey ec=echo $1 >> filename.txt

I would have thought this would allow me to type:

> ec "some_string"

and have the string automagically appended to the file specified in the macro. However, all it does is echo "some_string" to standard output, without appending to the file, like this:

> ec "some_string"
"some_string"

Is there a way to properly construct this macro, or will I have to avoid the problem by writing a script and setting my macro to call that script?
__________________

__________________
DEADFA11 is offline  
Old 06-03-2010, 03:44 PM   #2 (permalink)
It's all just 1s and 0s
 
office politics's Avatar
 
Join Date: Jan 2004
Location: in the lab
Posts: 6,555
Send a message via MSN to office politics
Default Re: Windows macro for appending to files

you can write a batch file that accepts one argument as follows

Code:
echo %1 >> filename.txt
if you name this file runme.bat, then then the command you would want to repeat is

runme "some string"
runme "some string #2"
runme "some string #3"
__________________

office politics is offline  
Old 06-04-2010, 07:11 AM   #3 (permalink)
Newb Techie
 
Join Date: May 2010
Posts: 10
Default Re: Windows macro for appending to files

That'll do nicely. Thank you very much.
__________________
DEADFA11 is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash and DivX players Arcadian Microsoft Windows and Software 4 07-25-2010 01:58 PM
MBAM and Hijackthis logs joel2007 HijackThis Logs (finished) 26 12-10-2009 11:02 PM
Hijackthis log Jamez HijackThis Logs (finished) 17 09-23-2009 08:20 PM
The many versions of XP EricB Microsoft Windows and Software 6 10-26-2008 01:54 PM
Home Edition Troubles ChemicalMonkey Microsoft Windows and Software 34 01-20-2008 08:26 PM



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 01:13 PM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.