无忧启动论坛

标题: bat进制问题,求方案 [打印本页]

作者: kkkssc    时间: 2019-11-9 11:50
标题: bat进制问题,求方案
本帖最后由 kkkssc 于 2019-11-9 12:07 编辑

set date=%date%
set /a namedate=%date:~0,4%
set /a date_month=%date:~5,2%
set /a date_day=%date:~8,2%
if %date_month% leq 9 set namedate=%namedate%0%date_month% else set namedate=%namedate%%date_month%
if %date_day% leq 9 set namedate=%namedate%0%date_day% else set namedate=%namedate%%date_day%

set time=%time%
set /a nametime=%time:~0,2%
set /a time_minute=%time:~3,2%
set /a time_second=%time:~6,2%
if %nametime% leq 9 set nametime=0%nametime%
if %time_minute% leq 9 set nametime=%nametime%0%time_minute% else set nametime=%nametime%%time_minute%
if %time_second% leq 9 set nametime=%nametime%0%time_second% else set nametime=%nametime%%time_second%

rename F:\Temp\FireFoxCookiesBackup\cookies.sqlite "cookies_%namedate%%nametime%.sqlite"


cd "X:\Mozilla Firefox\UserProfileKH"
xcopy cookies.sqlite F:\Temp\FireFoxCookiesBackup\ /y

@ping 127.0.0.1 -n 5 >null
@exit

一个备份ramdisk中firefox cookies的小脚本,平时没问题,但是只要当有数字出现在9~15的时候,就会报进制错误,不能执行,大侠们看看怎么改?
作者: nttwqz    时间: 2019-11-9 20:25
楼主对文件名日期时间的要求可真高啊 ,直接这样不好吗?何必那个复杂!

  1. echo;%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
复制代码





欢迎光临 无忧启动论坛 (http://wuyou.net/) Powered by Discuz! X3.3