我使用 NSIS 开发了一个安装程序.每次重新安装应用程序时,我都想创建现有数据库文件的备份。
如何使用以下格式“当前日期时间”重命名这些数据库文件(例如:201003101140 表示 2010-03-10 上午 11:40)?
谢谢 !
最佳答案
NSIS 中有一个内置函数,称为 ${GetTime}
!include "FileFunc.nsh"
!insertmacro GetTime
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
DetailPrint "currentdatetime=$2$1$0$4$5$6"
这将输出类似
currentdatetime=20130210205537
意思是“2013 年 2 月 10 日 20:55:37”。
关于nsis - 使用 NSIS 将当前日期和时间写为文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2407509/