Batch File that will create a dynamic file name based on System Date
I've been working on batch files recently. My client would want to copy the files to network access storage (NAS). The scenario would be that we daily the system will copy certain file to NAS to avoid overriding the file we want a dynamic file name. One of the option is to use vb script invoking file system object. Another is to use batch file. Batch file would be the first choice for ease of use. The question would then be how are we going to do this such that we file name will be using the system date? The answer is.
set strname="%date:~10,4%-%date:~4,2%-%date:~7,2%"
You may also refer to this blog post.
I've been working on batch files recently. My client would want to copy the files to network access storage (NAS). The scenario would be that we daily the system will copy certain file to NAS to avoid overriding the file we want a dynamic file name. One of the option is to use vb script invoking file system object. Another is to use batch file. Batch file would be the first choice for ease of use. The question would then be how are we going to do this such that we file name will be using the system date? The answer is.
set strname="%date:~10,4%-%date:~4,2%-%date:~7,2%"
You may also refer to this blog post.
No comments:
Post a Comment