Batch file to copy file with todays date
Forums New posts Search forums. What's new New posts Unanswered threads Latest activity. Members Current visitors. Log in Sign up. Search titles only. Search Advanced search…. New posts. Search forums. Log in. Sign up. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Ok on that, your original destination path has spaces so must be enclosed in " " See this line in the code for an example: Code: [Select].
Now I have specify a filename? How can I overcome this? I works fine if path has no spaces. Can I get around this? Quote from: petreli. Well done - great performance. Thank you for coming back to report your success. Can Make this Work. Back to Windows Forum. Start or search. Start New Discussion. Create a new discussion If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem.
Track this discussion and email me when there are updates. Those numbers will be used to mark a position of every number or the letter in the date string. When we run this batch file from the command prompt, we will see current date. Here is English US date format:. Here is another example of the changed local settings. I changed short date format to display the date on the way more common to the Serbian local settings.
Those numbers under the date string will be the position counter. First character in this string have a position of 0. This is the reason why we begin with 0 in the counter. We will continue with first example, the US date format. As we can see, we have three letter abbreviation of the name of the day, then we have space, the number of the month in the year, the number of the day in the month and finally the year by the Gregorian calendar.
We need a day, a month and a year. We will then repack that information to one string for a today date. Then we can use it to create the directory per day or we can add it to the end of the file, like some log or the output result files.
When we add the date string in such order, we can later sort the files and folders in ascending order, the day after day, in the chronological order. Here is an example of the folders the ClamAV quarantine folder sorted by date in their name:. We can now see when we caught some viruses in an e-mail.
Furthermore, we can easily find any e-mail held in the quarantine and check it further. Now that we know what we need to extract, we can use this to write our batch file.
Here is the content of this file:. Main part of this batch is done in the first three lines beginning with the command SET.
0コメント