Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Other Scripting Languages (http://www.programmingforums.org/forum39.html)
-   -   Batch Pipe command - output formatting (http://www.programmingforums.org/showthread.php?t=12881)

tAK Mar 26th, 2007 11:12 PM

Batch Pipe command - output formatting
 
Hey guys,

i have a bat script that runs for whenever a user logs in, it outputs information, in what is close to an ini file format (key=value) with 2 exceptions, being the date and time..

it outputs:
Time=
12:45 PM
Date=
Tue 27/03/2007

Any way to get it to output it as:
Time=12:45 PM
Date=Tue 27/03/2007

the code that currently runs:
Code:

ECHO.Time=>>"c:\Output.txt" time /t>>""c:\Output.txt" ECHO.Date=>>"c:\Output.txt" date /t>>"c:\Output.txt"

i was thinking this should work (to produce the requred format) but it outputs the same as before:
Code:

ECHO.Time=>>"c:\Output.txt" | time /t>>""c:\Output.txt" ECHO.Date=>>"c:\Output.txt" | date /t>>"c:\Output.txt"


any help appreciated.

/tAK

mackenga May 19th, 2007 6:40 PM

If you put [ code ] tags around your source it'll make more pleasant reading. I don't do a lot of work with .BAT files - I'm tempted to say 'get a real shell' but I seem to remember the SET command is quite flexible and useful; maybe you can get the output of the TIME / DATE commands into a variable with it or something like that?

Hopefully this helps. I'm too lazy to investigate further.


All times are GMT -5. The time now is 12:20 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC