如何在 vbscript 中重命名文件以包含时间戳? [英] How can I rename a file in vbscript so as to contain timestamp?
本文介绍了如何在 vbscript 中重命名文件以包含时间戳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问题:将文件重命名为Result_[timestamp].csv",其中时间戳的格式为yyyymmddhhmmss
Problem: Rename the file to "Result_[timestamp].csv", where timestamp has format yyyymmddhhmmss
文件在 D:/path/mytest.csv
The file is on D:/path/mytest.csv
谢谢!
推荐答案
查看 FileSystemObject 的 MoveFile
方法或 File 对象的 Name 属性.例如:
Look at the MoveFile
method of the FileSystemObject or the Name property of the File object. For example:
CreateObject("Scripting.FileSystemObject").MoveFile strOldFileName, strNewFileName
或者:
CreateObject("Scripting.FileSystemObject").GetFile(strOldFileName).Name = strNewFileName
至于格式化日期,请参见this 今天早些时候的帖子.
As for formatting the date, see this post from earlier today.
祝你好运.
这篇关于如何在 vbscript 中重命名文件以包含时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文