Batch echo to log file




















Viewed k times. Would someone be able to tell me how to do this? Improve this question. Add a comment. Active Oldest Votes. Improve this answer. Andrew 5 5 silver badges 8 8 bronze badges. Ingrid Ingrid 1 1 silver badge 3 3 bronze badges. Excellent, thank you! My script poses a question - I'm not seeing it if this is used. How to log everything and see it on screen while executing? Yeah, how would you do that so that you can see it while it is on your screen? In your question, you mention: " You use the "wtee.

Kevin Fegan Kevin Fegan 4, 3 3 gold badges 20 20 silver badges 35 35 bronze badges. This script will execute ls and log its output to a file called log. Thorsten Staerk Thorsten Staerk 5 5 bronze badges. It's also not running a script, but logging the output of the commands you enter and omits the critical information of how to stop the madness I'm indeed talking about Windows. I would like to have the entire output to also be logged into a. Sign up or log in Sign up using Google. Sign up using Facebook.

Find centralized, trusted content and collaborate around the technologies you use most. Connect and share knowledge within a single location that is structured and easy to search. I am trying to use a BATCH file as a choose your own adventure story in which the user can create a character and be called by name and such by the characters in the story.

It hit me an hour back that it would be cool if as or after the BATCH file containing the story was run it made a log of all of the ECHO commands so that later the player could read what they did on any given play threw. Unfortunately all I can figure out how to do is to make a loge file with just the date and time.

This naturally just wont work. What do I do? Put that all to a variable first part , so you don't have to type that monsterstring to every line. In that case I would just use:. Btw: you don't have to delete the tempfile every time you use it, just delete it one time, just before the batch ends. As my other answer got quite long due to some edits, here is a new suggestion not much changed, but it makes the code quite easy to read :.

You cannot do that in batch script literally, but if you define functions, you can output data within the function block that also writes to a log file before the function returns, like so:.

Each time you echo for the player to know what happens, you could also echo into your log file, adding date and time at the beginning of your line : Simple as that for me. Don't know how your script looks though. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.

So is there a way to log the output to a file? Maybe a third party utility? Posted July 17, To log individual 'echo' commands, here is an example section taken from my batch file :. Posted July 20, Any Ideas? Perhaps an extra DOS utility? Posted July 22, Posted October 31, edited. Pause REM I thought you were! Ekko notice the flawed "command" on the last line for which i'd expect an entry in testerrors. Edited October 31, by tgf Posted October 31, Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community.

Register a new account. Sign in Already have an account? Sign In Now.



0コメント

  • 1000 / 1000