写当前日期 &使用 NSIS 作为文件名的时间 [英] writing current date & time as file name using NSIS

查看:61
本文介绍了写当前日期 &使用 NSIS 作为文件名的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 NSIS 开发了一个安装程序.每次重新安装应用程序时,我都想创建现有数据库文件的备份.

I developed an installer using NSIS. Every time I re-install the application, I want to create a backup of the existing database files.

如何使用以下格式currentdatetime"重命名这些数据库文件(例如:201003101140 表示 2010-03-10 上午 11:40)?

How can I rename these database files using the following format 'currentdatetime'(ex: 201003101140 means 2010-03-10 at 11:40 AM)?

谢谢!

推荐答案

NSIS 中有一个内置函数 ${GetTime}

There is a built-in function in NSIS for this called ${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

意思是10-Feb-2013 20:55:37".

meaning "10-Feb-2013 20:55:37".

这篇关于写当前日期 &使用 NSIS 作为文件名的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆