Take notes on the command line

From Rosetta Code
Revision as of 14:57, 1 April 2010 by rosettacode>Axtens (New task)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Task
Take notes on the command line
You are encouraged to solve this task according to the task description, using any language you may know.
Take notes on the command line is part of Axtens's Console Program Basics selection.

Take notes on command line

NOTES.CMD is a commandline tool written in DOS Batch language. The task is to implement the same in your language.

Invoking NOTES without commandline arguments displays the current contents of the local NOTES.TXT if it exists. If NOTES has arguments, the current date and time are appended to the local NOTES.TXT followed by a newline. Then all the arguments, joined with a space, and prepended with a tab, are written to NOTES.TXT

<lang dos> @echo off if %1@==@ ( if exist notes.txt more notes.txt goto done ) echo %date% %time%:>>notes.txt echo %*>>notes.txt

done

</lang>