Windows batch append timestamp to file




















It only takes a minute to sign up. Connect and share knowledge within a single location that is structured and easy to search. I can schedule it to run multiple times a day to pick up any that weren't processed before. So here's my code so far. I've pieced it together from google and it works in a fashion but doesn't do quite what I want. It finds the file ok. It renames it in the format I want but uses current date and time, not sure how to use modified or created date instead and moves it correctly.

But it only works for a single file. If there are multiple files in the directory it errors out that it can't merge multiple files into a single file which makes sense, it can't rename all files to 1 file. But I'm stuck. I don't know how to take it further. Can someone help me out? I vaguely understand what the code is doing but not enough to manipulate it into doing what I want.

Powershell would also be an option but I know even less about how to do it in there. If there's another option that can be easily scheduled through task scheduler that would work too.

This bit of powershell does what you want. Just put the full path to the source and destination directories at the top between the quotation marks.

Edit: added the bit about file creation time. As an aside, I highly suggest setting a bit of time each day aside to learning PowerShell, it's really a great tool, and much more user friendly than batch scripts, as scripting languages go it's easy to read, mostly because it's written in almost plain english.

This is a good resource for resources! Sign up to join this community. Create a simple batch file that outputs to a text file ONLY when a ping fails and also include the time of the failure. Ping statistics for So every instance of the above line is a ping failure and all successful pings will NOT be recorded to the file. This allows me to open a small text file and at a glance see the specific times a particular IP address was inaccessible.

The hope is to be able to line up ping failures with backup failures. But this could be used in troubleshooting many random timeout errors in applications, etc. This line denotes the beginning of a new test. Perfect Krizz, that's exactly what I'm after. To continue this discussion, please ask a new question. Get answers from your peers along with millions of IT pros who visit Spiceworks.

TIA Andrew K. Best Answer. Krizz This person is a verified professional. Verify your account to enable IT peers to see that you are a professional.



0コメント

  • 1000 / 1000