|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
qwe1234567斑竹,您刚才发的2000环境下的程序代码怎么不见了?
Moderator qwe1234567, why did the program code you posted earlier under the 2000 environment disappear?
|
|
2006-10-15 10:55 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
set a=%date:~4,4%%date:~9,2%%date:~12,2%@%time:~0,2%%time:~3,2%%time:~6,2%
ren *.txt *%a%.txt
你如果想把TEST.TXT这个文件修改,只要把*.txt换成test.txt就可以,你如果把这个文件放在你需要改文件名的文件夹里就可以不要路径,还可以改所有的TXT文件名!
Last edited by qwe1234567 on 2006-10-15 at 10:57 ]
set a=%date:~4,4%%date:~9,2%%date:~12,2%@%time:~0,2%%time:~3,2%%time:~6,2%
ren *.txt *%a%.txt
If you want to modify the TEST.TXT file, you just need to replace *.txt with test.txt. If you put this file in the folder where you need to change the file names, you can omit the path, and you can also change all TXT file names!
Last edited by qwe1234567 on 2006-10-15 at 10:57 ]
|

我的网络U盘 我的网络第2个U盘
论坛软件下载链接
灵雨飘零论坛
论坛新手必读,所有人的基本行为准则
刷QQ空间人气、留言的小软件 |
|
2006-10-15 10:56 |
|
|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
非常感谢,周一我看主管到底还有还需要其他特殊功能~~~
Thank you very much. I will see what other special functions the supervisor needs on Monday.
|
|
2006-10-15 11:00 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
参照qwe1234567版主2K的修改一下:
XP
@echo off
set datetime=%~n1%date:~0,4%%date:~5,2%%date:~8,2%@%time:~0,2%%time:~3,2%%time:~6,2%%~x1
echo %1 %datetime%
2K
@echo off
set datetime=%~n1%date:~4,4%%date:~9,2%%date:~12,2%@%time:~0,2%%time:~3,2%%time:~6,2%%~x1
echo %1 %datetime%
把“echo”改为“copy”、“ren”...
运行方式均为:bat *.txt(带扩展名)
Refer to the modification by moderator qwe1234567 for 2K:
XP
@echo off
set datetime=%~n1%date:~0,4%%date:~5,2%%date:~8,2%@%time:~0,2%%time:~3,2%%time:~6,2%%~x1
copy %1 %datetime%
2K
@echo off
set datetime=%~n1%date:~4,4%%date:~9,2%%date:~12,2%@%time:~0,2%%time:~3,2%%time:~6,2%%~x1
copy %1 %datetime%
The operation method is: bat *.txt (with extension)
|
|
2006-10-15 11:00 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
综合zxcv、qwe1234567版主,DOS.BAT内容
@echo off
if "%1"=="/?" echo 将目标文件名重命名为“源文件名+当前日期+@+时间” &&echo.&&echo 语法: DOS filename &&PING/n 4 127.1>NUL &&exit
if "%1"=="" echo 将目标文件名重命名为“源文件名+当前日期+@+时间” &&echo.&&echo 语法: DOS filename &&PING/n 4 127.1>NUL &&exit
ver|find /i "xp">nul
if not errorlevel 1 set datetime=%~n1%date:~0,4%%date:~5,2%%date:~8,2%@%time:~0,2%%time:~3,2%%time:~6,2%%~x1
ver|find /i "2000">nul
if not errorlevel 1 set datetime=%~n1%date:~4,4%%date:~9,2%%date:~12,2%@%time:~0,2%%time:~3,2%%time:~6,2%%~x1
if "%datetime%"=="" echo 此程序必须在Windows xp或Windows 2000系统上运行 &&ping/n 4 127.1>nul &&exit
echo %1 %datetime%
Integrated with zxcv, qwe1234567 moderators, DOS.BAT content
@echo off
if "%1"=="/?" echo Rename the target file name to "source file name + current date + @ + time" &&echo.&&echo Syntax: DOS filename &&PING/n 4 127.1>NUL &&exit
if "%1"=="" echo Rename the target file name to "source file name + current date + @ + time" &&echo.&&echo Syntax: DOS filename &&PING/n 4 127.1>NUL &&exit
ver|find /i "xp">nul
if not errorlevel 1 set datetime=%~n1%date:~0,4%%date:~5,2%%date:~8,2%@%time:~0,2%%time:~3,2%%time:~6,2%%~x1
ver|find /i "2000">nul
if not errorlevel 1 set datetime=%~n1%date:~4,4%%date:~9,2%%date:~12,2%@%time:~0,2%%time:~3,2%%time:~6,2%%~x1
if "%datetime%"=="" echo This program must run on Windows xp or Windows 2000 system &&ping/n 4 127.1>nul &&exit
echo %1 %datetime%
|

第一高手 第二高手
我的小站
 |
|
2006-10-15 12:18 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
On Error Resume Next
Set objArgs = WScript.Arguments
If objArgs.Count < 1 Then
WScript.Echo "用鼠标把文件拖到该文件上或带参数运行!"
WScript.Quit
End If
For Each strFile In objArgs
strNewFile = Mid(strFile,1,InStrRev(strFile,".") _
- 1) & Replace(Date,"-","") & "@" _
& Replace(Time,":","") & _
Mid(strFile,InStrRev(strFile,".") )
If Len(Trim(strNewFile)) = 0 Then
strNewFile = strFile & Replace(Date,"-","") & _
"@" & Replace(Time,":","")
End If
ReName strFile , strNewFile
Next
Sub ReName (strFile,strNewFile)
WScript.Echo strFile & vbLf & strNewFile
CreateObject("Scripting.FileSystemObject") _
.MoveFile strFile,strNewFile
End Sub
拷贝到SendTo,然后把要改的文件全部选定发送到...就行了。
或者在bat里面带多参数调用,可以更改ReName过程下第一句的vblf为","用来显示更改明细以便形成日志.
```
On Error Resume Next
Set objArgs = WScript.Arguments
If objArgs.Count < 1 Then
WScript.Echo "Drag files to this file with mouse or run with arguments!"
WScript.Quit
End If
For Each strFile In objArgs
strNewFile = Mid(strFile,1,InStrRev(strFile,".") _
- 1) & Replace(Date,"-","") & "@" _
& Replace(Time,":","") & _
Mid(strFile,InStrRev(strFile,".") )
If Len(Trim(strNewFile)) = 0 Then
strNewFile = strFile & Replace(Date,"-","") & _
"@" & Replace(Time,":","")
End If
ReName strFile , strNewFile
Next
Sub ReName (strFile,strNewFile)
WScript.Echo strFile & vbLf & strNewFile
CreateObject("Scripting.FileSystemObject") _
.MoveFile strFile,strNewFile
End Sub
```
Copy to SendTo, then select all the files to be modified and send to... That's it.
Or call with multiple parameters in bat, you can change the first line of the ReName procedure from vblf to "," to display the change details for forming a log.
|
|
2006-10-15 13:00 |
|
|
milertom
初级用户
 
积分 28
发帖 11
注册 2006-10-12
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
我这里只有不到上午11点,怎么你们都
2006-10-15 13:00了,
版主啊,服务器时间是不是有问题啊
I only have less than 11:00 AM here, why are you all at 2006-10-15 13:00, Moderator, is there a problem with the server time?
|
|
2006-10-15 22:51 |
|
|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
各位高手
刚才主管跟我说是在2000 server en 环境下测试的,我copy了下date与time
C:\Documents and Settings\Administrator>date
The current date is: 10/16/2006 Mon
Enter the new date: (mm-dd-yy)
C:\Documents and Settings\Administrator>time
The current time is: 10:44:17.73
Enter the new time:
fastslz,您能登下MSN吗,我想请教你些问题,万分感谢
Dear all experts,
Just now, my supervisor told me that it was tested in the 2000 server en environment. I copied the date and time.
C:\Documents and Settings\Administrator>date
The current date is: 10/16/2006 Mon
Enter the new date: (mm-dd-yy)
C:\Documents and Settings\Administrator>time
The current time is: 10:44:17.73
Enter the new time:
fastslz, can you log in to MSN? I want to ask you some questions, thank you very much
|
|
2006-10-16 22:53 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
set a=%date:~6,4%%date:~0,2%%date:~3,2%@%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%
ren *.txt *%a%.txt
```
set a=%date:~6,4%%date:~0,2%%date:~3,2%@%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%
ren *.txt *%a%.txt
```
|

我的网络U盘 我的网络第2个U盘
论坛软件下载链接
灵雨飘零论坛
论坛新手必读,所有人的基本行为准则
刷QQ空间人气、留言的小软件 |
|
2006-10-16 23:04 |
|
|
maya0su
中级用户
  
积分 241
发帖 131
注册 2005-9-28
状态 离线
|
『第 25 楼』:
使用 LLM 解释/回答一下
@echo off
set /p yy=欲处理文件的路径:
set /p uu=欲处理文件的名称:
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 (%yy%:\%uu%) do copy %%i %yy%:\%%~ni%DATE%@%TIME%.txt
借用了fastslz的代码,不过加上如上几句,可以处理任何一个盘符的文件!另:欲处理文件的路径: 在显示这句时,盘符不用输入冒号的!
@echo off
set /p yy=Path of the file to be processed:
set /p uu=Name of the file to be processed:
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 (%yy%:\%uu%) do copy %%i %yy%:\%%~ni%DATE%@%TIME%.txt
Borrowed fastslz's code, but with the above几句 added, it can process files on any drive letter! Also: When displaying this sentence, do not enter a colon after the drive letter!
|

房东说:这娃是个好孩子! |
|
2006-10-16 23:13 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
Originally posted by samzj at 2006-10-16 22:53:
各位高手
刚才主管跟我说是在2000 server en 环境下测试的,我copy了下date与time
C:\Documents and Settings\Administrator>date
The current date is: 10/16/2006 Mon
Enter t ...
英文版的时间顺序不一样的
如果用我的代码把
for /F "tokens=1-3 delims=/- " %%A in ('date/T') do set DATE=%%A%%B%%C
替换成
for /F "tokens=1-3 delims=/- " %%A in ('date/T') do set DATE=%%C%%B%%A
也就换了一下顺序,这个容易掌握
Originally posted by samzj at 2006-10-16 22:53:
Hello everyone
Just now, my supervisor told me that the test was carried out in the 2000 server en environment. I copied the date and time.
C:\Documents and Settings\Administrator>date
The current date is: 10/16/2006 Mon
Enter t ...
The time sequence in the English version is different.
If I replace
for /F "tokens=1-3 delims=/- " %%A in ('date/T') do set DATE=%%A%%B%%C
in my code with
for /F "tokens=1-3 delims=/- " %%A in ('date/T') do set DATE=%%C%%B%%A
that is, just change the order, which is easy to grasp.
|

第一高手 第二高手
我的小站
 |
|
2006-10-17 00:01 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
这样的问题最好
echo %time%
echo %date%
把这两个显示发上来
The best for such a problem
echo %time%
echo %date%
Post these two displays
|
|
2006-10-17 01:09 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
   『第 28 楼』:
使用 LLM 解释/回答一下
@echo off
set /p lj=欲处理文件的路径:
set /p wjm=欲处理文件的名称:
copy %lj%%wjm% %lj%%wjm%%date:~10,4%%date:~4,2%%date:~7,2%@%time:~0,2%%time:~3,2%%time:~6,2%.txt
```batch
@echo off
set /p lj=Path of the file to be processed:
set /p wjm=Name of the file to be processed:
copy %lj%%wjm% %lj%%wjm%%date:~10,4%%date:~4,2%%date:~7,2%@%time:~0,2%%time:~3,2%%time:~6,2%.txt
```
此帖被 +4 点积分 点击查看详情 评分人:【 】 | 分数: +4 | 时间:2006-10-17 04:47 |
|
|

我的网络U盘 我的网络第2个U盘
论坛软件下载链接
灵雨飘零论坛
论坛新手必读,所有人的基本行为准则
刷QQ空间人气、留言的小软件 |
|
2006-10-17 02:21 |
|
|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
谢谢各位的热心帮助~~~~
今天在qwe1234567斑竹的远程指导下,最终暂时解决了这个问题,
测试环境 2000 server en
C:\Documents and Settings\Administrator>date
The current date is: 10/16/2006 Mon
Enter the new date: (mm-dd-yy)
C:\Documents and Settings\Administrator>time
The current time is: 15:56:45.35
Enter the new time:
set a=%date:~10,4%%date:~4,2%%date:~7,2%@%time:~0,2%%time:~3,2%%time:~6,2%
copy c:\test.bat test%a%.bat
最终成功,谢谢以上所有回贴帮忙的人!!!!
Thanks to everyone's enthusiastic help~~~~
Today, under the remote guidance of moderator qwe1234567, this problem was finally temporarily solved.
Test environment: 2000 server en
C:\Documents and Settings\Administrator>date
The current date is: 10/16/2006 Mon
Enter the new date: (mm-dd-yy)
C:\Documents and Settings\Administrator>time
The current time is: 15:56:45.35
Enter the new time:
set a=%date:~10,4%%date:~4,2%%date:~7,2%@%time:~0,2%%time:~3,2%%time:~6,2%
copy c:\test.bat test%a%.bat
Finally successful, thank you all who posted to help!!!!
|
|
2006-10-17 03:58 |
|
|
samzj
初级用户
 
积分 30
发帖 14
注册 2006-10-15
状态 离线
|
『第 30 楼』:
使用 LLM 解释/回答一下
以及还要十分感谢fastslz的耐心讲解~~~~~~等等等等
And also need to thank fastslz for the patient explanation~~~~~~ and so on and so forth
|
|
2006-10-17 03:59 |
|
|