|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『楼 主』:
主管布置周一交的任务,望高手相助~DOS.BAT文件改名应用程序
使用 LLM 解释/回答一下
文件改名应用程序
需求如下:
1. 用于在命令行下改名。
2. 格式 changename source
3. 扩展名保持不变
4. destination=source + date + "@" +time,也就是说,目标文件名是源文件名+当前日期+"@"+时间
举例: ack.txt, 假设运行程序时间为2006-09-17, 14:22:50
执行change ack
输出结果 ack20060917@142250.txt
在线等,万分感谢。。。
更新下,系统是2000的。
Last edited by namejm on 2006-11-6 at 01:23 PM ]
File Renaming Application
Requirements are as follows:
1. For renaming under the command line.
2. Format: changename source
3. The extension remains unchanged.
4. destination = source + date + "@" + time, that is, the target file name is the source file name + current date + "@" + time.
For example: ack.txt, assuming the running program time is 2006-09-17, 14:22:50.
Execute change ack.
The output result is ack20060917@142250.txt
Waiting online, thank you very much...
Updated, the system is 2000.
Last edited by namejm on 2006-11-6 at 01:23 PM ]
|
|
2006-10-15 09:48 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
|
2006-10-15 09:53 |
|
|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
主管就跟我说是DOS程序,我这方面还是很菜的。。程序应该在2000下运行的,谢谢了
The supervisor just told me it's a DOS program, and I'm still quite green in this area. The program should run under Windows 2000. Thanks.
|
|
2006-10-15 09:55 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
|
2006-10-15 10:03 |
|
|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
Fastslz,谢谢了,你能帮忙做个XP的吗,毕竟公司里大多数是2000的,但也有十多台是XP的~~
Fastslz, thank you. Can you help make one for XP? After all, most in the company are 2000, but there are more than a dozen that are XP~~
|
|
2006-10-15 10:09 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
目前大多数人使用的是XP的系统,2K系统个人用户使用得已经比较少了。XP下的日期和2K下的日期格式不太一样,如果用户对日期的长短格式做了设置的话,就算是同是XP的机子,日期的格式也是不一样的,2K下可能也是这样的情况。请楼主在你的2K机子上分别运行 date 和 time,然后把结果发出来看看再说。一旦解决了日期问题,其他的问题都不在话下。
Currently, most people are using the XP system, and the 2K system is used relatively less by individual users. The date format under XP is different from that under 2K. If the user has set the short or long format of the date, even on the same XP machine, the date format will be different, and the same may be the case under 2K. Please the landlord run date and time on your 2K machine respectively and then post the results to see. Once the date problem is solved, other problems will be easy to handle.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-10-15 10:12 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
我重来不帮别人做作业,呵呵。我不会透露作业都是我亲手自己抄的这个秘密的~~~
I never help others with their homework, heh heh. I won't reveal the secret that all the homework is copied by myself~~~
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-10-15 10:14 |
|
|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
谢谢斑竹和fastslz
C:\Documents and Settings\Administrator>date
当前日期: 2006-10-14 星期六
输入新日期: (年月日)
C:\Documents and Settings\Administrator>time
当前时间: 22:11:17.54
输入新时间:
这是我家里的XP,公司的机器不管是XP和2000也都是默认的时间设置,因为都是我安装的,没动过这方面的设置
Thanks toiled and fastslz
C:\Documents and Settings\Administrator>date
Current date: 2006-10-14 Saturday
Enter new date: (year/month/day)
C:\Documents and Settings\Administrator>time
Current time: 22:11:17.54
Enter new time:
This is the XP at my home. The machines in the company, whether XP or 2000, also have the default time settings. Because I installed them all and didn't touch this aspect of the settings
|
|
2006-10-15 10:17 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
@echo off
for /F "tokens=1-3 delims=/- " %%A in ('date/T') do set DATE=%%A%%B%%C
for /F "tokens=1-2 delims=/: " %%A in ('time/T') do set TIME=%%A%%B
for %%i in (E:\ack.txt) do copy %%i E:\%%~ni%DATE%@%TIME%.txt
@echo off
for /F "tokens=1-3 delims=/- " %%A in ('date/T') do set DATE=%%A%%B%%C
for /F "tokens=1-2 delims=/: " %%A in ('time/T') do set TIME=%%A%%B
for %%i in (E:\ack.txt) do copy %%i E:\%%~ni%DATE%@%TIME%.txt
|

第一高手 第二高手
我的小站
 |
|
2006-10-15 10:19 |
|
|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
electronixtar,其实我也不想让别人帮做的,我试过用VB写,可老错误,主管后来说要DOS下程序的,我对这方面不是很熟悉,所以找到了这个论坛暂时解决当务之急,然后再好好的学习下:)
electronixtar, actually I don't want others to help with this either. I tried writing it with VB, but there were always errors. Later, the supervisor said a program under DOS was needed. I'm not very familiar with this aspect, so I found this forum to temporarily solve the immediate problem, and then I'll study it well : )
|
|
2006-10-15 10:21 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
TIME只能是4位数哦,如果要求是重命名copy换成move
TIME can only be a 4-digit number哦,If the requirement is to rename copy to move
|

第一高手 第二高手
我的小站
 |
|
2006-10-15 10:27 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
@echo off
setlocal EnableDelayedExpansion
set date$=%date%&&set date$=!date$:~0,10!&&set date$=!date$:-=!
set time$=%time%&&set time$=!time$:~0,8!&&set time$=!time$::=!
echo %1 %~n1%date$%@%time$%%~x1
@echo off
echo %1 %~n1%date:~0,4%%date:~5,2%%date:~8,2%@%time:~0,2%%time:~3,2%%time:~6,2%%~x1
将“echo”改为“copy”...
运行格式都是:bat *.txt(需要带文件扩展名)
Last edited by zxcv on 2006-10-14 at 22:30 ]
@echo off
setlocal EnableDelayedExpansion
set date$=%date%&&set date$=!date$:~0,10!&&set date$=!date$:-=!
set time$=%time%&&set time$=!time$:~0,8!&&set time$=!time$::=!
echo %1 %~n1%date$%@%time$%%~x1
@echo off
echo %1 %~n1%date:~0,4%%date:~5,2%%date:~8,2%@%time:~0,2%%time:~3,2%%time:~6,2%%~x1
Change "echo" to "copy"...
The running format is all: bat *.txt (needs to bring the file extension)
Last edited by zxcv on 2006-10-14 at 22:30 ]
|
|
2006-10-15 10:29 |
|
|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
fastslz:万分感谢,我这边做了您的测试程序,XP下OK了。。现在就是不知道2000下如何执行,可否提供下您的MSN,以便于我周一和您联系。。或者我的MSN: delonkgb@hotmail.com 顺便谢谢以上所有提供信息的同志~
fastslz: Thanks a million. I've run your test program and it works fine under XP. Now I just don't know how to run it under 2000. Could you provide your MSN so that I can contact you on Monday? Or my MSN: delonkgb@hotmail.com By the way, thanks to all the comrades who provided information above~
|
|
2006-10-15 10:33 |
|
|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
再次感谢以上所有的斑竹和其他热心的朋友 。。。
顺便问下qwe1234567斑竹,
ren *.txt *%a%.txt 我是不是可以理解我想把TEST.TXT这个文件修改,只要把*.txt换成test.txt就可以了??需要路经吗。。
具体情况我到周一时再给大家看下最终的状况,有问题再麻烦大家,再次谢谢大家的热心相助。
Last edited by samzj on 2006-10-15 at 10:47 ]
Once again, thank you to all the moderators and other enthusiastic friends...
By the way, moderator qwe1234567,
Can I understand that for ren *.txt *%a%.txt, I can change *.txt to test.txt to modify the TEST.TXT file? Do I need a path??
I will show you the final situation to everyone on Monday. If there are problems, trouble everyone again. Once again, thank you all for your enthusiastic help.
Last edited by samzj on 2006-10-15 at 10:47 ]
|
|
2006-10-15 10:42 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
|
2006-10-15 10:47 |
|