|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 46 楼』:
使用 LLM 解释/回答一下
Re willsort:
在本程序脚本的最开始加入版主提供的代码if not "%1"=="$" %comspec% /f:on /c %0 $ && goto :eof,确实能实现自动完成文件名的功能。只是在测试过程中,发现了如下图所示的奇怪现象。
出现问题的条件是:当按Ctrl+F或者Ctrl+D输入的文件名比上一次短得多的时候,会在文件名后有上一文件名的残余,如果一次比一次更短,则有更多的残余出现,但是并不影响程序的正确执行。
另外,对这句代码的确切含义并不了解,版主能否解释一下?
Re willsort:
Adding the code provided by the moderator at the very beginning of this program script, if not "%1"=="$" %comspec% /f:on /c %0 $ && goto :eof, indeed enables the function of automatically completing the file name. However, during testing, the strange phenomenon shown in the following figure was discovered.
The condition for the problem to occur is: when entering a file name that is much shorter than the previous one by pressing Ctrl+F or Ctrl+D, there will be remnants of the previous file name after the current file name. If it is shorter each time, more remnants will appear, but it does not affect the correct execution of the program.
In addition, I don't understand the exact meaning of this code. Can the moderator explain it?
附件
1: 错误的显示.jpg (2006-6-7 00:18, 8.2 KiB, 下载附件所需积分 1 点
,下载次数: 8)
|
|
2006-6-7 00:18 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 47 楼』:
使用 LLM 解释/回答一下
Re namejm:
这个现象在我的测试中也出现了,而且在CMD环境中也存在。这也是我所说的“附加的影响”之一,目前我尚未发现好的解决办法,只能推测是cmd自动完成特性存在一些问题。不过它并不是在所有文件名由长变短的时候出现,具体的规律和解决的办法希望其它达人也能想想办法,或者你也可以在命令行区或解答室发表求助主题。
关于 if not 一句的含义,意为当命令行第一参数不为"$"时使用cmd(%comspec%指向cmd的位置)重新调用批处理自身,调用的同时加上第一参数$以防止cmd的反复调用。因为我们要使用cmd /f:on来开启自动完成的扩展特性,而在批处理中使用cmd会创建新的cmd环境,从而中断批处理运行,所以需要在其后使用/c %0重新进入批处理自身。
这就是所谓的“批处理重入”技术,这里使用重入技术就是为了获取一个新的符合特定要求的命令行环境来解释一个特殊的批处理程序或者自身;而另外一些时候,批处理的重入不是通过cmd而是call或者直接调用批处理来实现,这通常是为了实现命令行参数的重新设定。
另外,已知的附加影响还包括:批处理中的所有环境变量将变成“局部”的,在退出批处理后将失效;系统环境变量%cmdcmdline%将被修改;运行过程中内存中将增加一个新的cmd实例(进程)。
无奈何签名代码略析
http://www.cn-dos.net/forum/viewthread.php?tid=18838
关于 HDKP 的几点技术探讨
http://www.cn-dos.net/forum/viewthread.php?tid=12892#pid95281
已结:将文件名改为001.txt 010.txt...100.txt
http://www.cn-dos.net/forum/viewthread.php?tid=14512
Last edited by willsort on 2006-6-7 at 21:32 ]
Re namejm:
This phenomenon also occurred in my test, and it also exists in the CMD environment. This is also one of the "additional effects" I mentioned. Currently, I haven't found a good solution, and I can only speculate that there are some problems with the cmd auto-completion feature. However, it doesn't occur every time the file name changes from long to short. I hope other experts can think about the specific pattern and solutions, or you can post a help topic in the command line area or the Q&A room.
Regarding the meaning of the if not sentence, it means that when the first parameter of the command line is not "$", use cmd (where %comspec% points to the location of cmd) to re-invoke the batch script itself, and add the first parameter $ at the same time to prevent repeated invocation of cmd. Because we need to use cmd /f:on to enable the extended features of auto-completion, and using cmd in the batch script will create a new cmd environment, thereby interrupting the running of the batch script, so we need to use /c %0 afterwards to re-enter the batch script itself.
This is the so-called "batch script re-entry" technology. Here, the re-entry technology is used to obtain a new command line environment that meets specific requirements to interpret a special batch script or itself ; while at other times, the re-entry of the batch script is not through cmd but through call or directly invoking the batch script, which is usually to achieve the re-setting of command line parameters .
In addition, the known additional effects also include: all environment variables in the batch script will become "local" and will become invalid after exiting the batch script; the system environment variable %cmdcmdline% will be modified; a new cmd instance (process) will be added in memory during operation.
A Brief Analysis of the Helpless Signature Code
http://www.cn-dos.net/forum/viewthread.php?tid=18838
Some Technical Discussions about HDKP
http://www.cn-dos.net/forum/viewthread.php?tid=12892#pid95281
Closed: Change the file names to 001.txt 010.txt...100.txt
http://www.cn-dos.net/forum/viewthread.php?tid=14512
Last edited by willsort on 2006-6-7 at 21:32 ]
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-6-7 21:31 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 48 楼』:
使用 LLM 解释/回答一下
Re namejm:
刚才经过简单的测试,可以确定自动完成仅在完成中文名(或其它多字节字符名)文件或目录再次完成时出现问题。已将讨论帖转发在命令行区。
但估计此问题短时间内无法解决,再鉴于其不影响正常使用,可以考虑暂不作处理,当然用与不用还需要你自己来做权衡。另外,set /p 与cmd的命令提示符类似,可以使用DOSKey的一系列特性,使用光标键翻阅历史命令,而这些命令当然包括曾经输入的文件名,也可以使用ESC、F1至F10这些功能键辅助输入。另外,也可以使用右键菜单中的复制粘贴功能。
除此而外,我尚在考虑,是否可以将这个程序由定时备份改为定期备份,以避免备份时间经常被错过的问题,当然这需要大幅修改代码,也需要你做一下权衡。
CMD自动完成特性对中文文件和目录名存在问题
http://www.cn-dos.net/forum/viewthread.php?tid=21091
Re: namejm:
Just now, after a simple test, it can be determined that the auto-completion only has problems when re-completing files or directories with Chinese names (or other multi-byte character names). The discussion thread has been forwarded to the command line area .
But it is estimated that this problem cannot be solved in the short term, and considering that it does not affect normal use, you can consider not dealing with it for the time being. Of course, you need to make your own balance between using it or not. In addition, set /p is similar to the command prompt of cmd. You can use a series of features of DOSKey to scroll through the history commands with the cursor keys. Of course, these commands include the file names that were previously entered. You can also use function keys such as ESC, F1 to F10 to assist in input. In addition, you can also use the copy and paste function in the right-click menu.
In addition to this, I am still thinking about whether this program can be changed from timed backup to regular backup to avoid the problem of often missing the backup time. Of course, this requires a large-scale modification of the code, and you need to make a balance.
The auto-completion feature of CMD has problems with Chinese file and directory names
http://www.cn-dos.net/forum/viewthread.php?tid=21091
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-6-8 01:31 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 49 楼』:
使用 LLM 解释/回答一下
Re willsort:
后来想了一下,文件名的自动完成功能是一个比较高级的技巧,如果不是版主提出来,估计很多人都没想到。而在这个脚本程序中,已经有了用拖曳的方法来选择文件,很是省事,并且在运行的时候不会产生什么意外;而用文件名的自动完成功能,需要用组合键来多次选择才能找到要备份的文件,这个操作就显得比较烦琐了,何况会带来一些麻烦。基于以上情况,我觉得文件名的自动完成功能似乎可以取消。个人意见,欢迎探讨。
在我的机子上(xp+sp2),我一直在使用doskey的光标键翻阅历史命令的功能,不知道是不是系统默认开通的,所以在我的脚本程序中没有作这方面的提示。粘贴的方法,则没有作提示,在下版中将改进,以方便操作;而ESC、F1~F10这些功能键也没作提示,则是因为自己觉得在输入的时候可能不会有这么烦琐的输入,没有必要作任何提示。
不知道版主定期备份的具体操作是什么,定时备份不就已经含有定期备份的功能了么?请版主明示。
最近在忙单位的事情,6.10之后才会有比较多的时间来考虑这个脚本的更新,请各位原谅。
Re considerations:
After thinking about it later, the filename auto-completion function is a relatively advanced technique. If the forum moderator hadn't brought it up, I估计 many people wouldn't have thought of it. And in this script program, there is already a way to select files by dragging, which is very convenient, and there are no unexpected issues when running; however, using the filename auto-completion function requires using combination keys to select multiple times to find the file to back up, which is relatively cumbersome, and moreover, it will bring some troubles. Based on the above situation, I think the filename auto-completion function can probably be removed. Personal opinion, welcome to discuss.
On my computer (xp+sp2), I have been using the function of using the arrow keys of doskey to scroll through historical commands. I don't know if it's enabled by default in the system, so I didn't make this aspect of the prompt in my script program. The paste method was not prompted, and it will be improved in the next version to facilitate operation; and the function keys like ESC, F1~F10 were not prompted, which is because I feel that there might not be such cumbersome input when entering, so there is no need to make any prompts.
I don't know the specific operation of the forum moderator's regular backup. Isn't scheduled backup already containing the function of regular backup? Please make it clear to the forum moderator.
Recently, I've been busy with unit matters, and I will have more time to consider the update of this script after 6.10. Please forgive everyone.
|
|
2006-6-8 19:27 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 50 楼』:
使用 LLM 解释/回答一下
Re namejm:
定期备份与定时备份的算法区别主要在于它将不再依赖“计划任务”,或者说不再主要依赖“计划任务”。
定期备份算法主要描述如下:
首先,将自身代码或相应的任务代码与系统的启动时自动运行机制挂钩,确保在每次系统启动时可以运行;然后,在运行时判断当前日期是否符合用户预先设定的条件,如果匹配则启动指定任务,否则不做任何动作。
算法的核心在于自动运行挂钩和日期条件判断,在这两方面我只有比较初步的想法,还有一些细节需要完善。
算法的优势在于,因为它可以采用任务有效期机制,所以可以大幅避免“计划任务”因系统未启动而被跳过的可能性,这对不能保持不间断开机运行的个人用户比较有利。
Re: namejm:
The algorithm difference between regular backup and scheduled backup mainly lies in that it will no longer rely on "scheduled tasks", or mainly no longer rely on "scheduled tasks".
The regular backup algorithm is mainly described as follows:
First, hook its own code or corresponding task code with the automatic running mechanism at system startup to ensure that it can run every time the system starts; then, when running, judge whether the current date meets the conditions preset by the user. If it matches, start the specified task; otherwise, do nothing.
The core of the algorithm lies in the automatic running hook and date condition judgment. I only have relatively preliminary ideas in these two aspects, and there are still some details to be perfected.
The advantage of the algorithm is that because it can adopt the task validity period mechanism, it can greatly avoid the possibility that "scheduled tasks" are skipped because the system is not started, which is more beneficial to individual users who cannot keep the computer running uninterruptedly.
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-6-9 02:30 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 51 楼』:
使用 LLM 解释/回答一下
Originally posted by willsort at 2006-6-9 02:30:
Re namejm:
算法的优势在于,因为它可以采用任务有效期机制,所以可以大幅避免“计划任务”因系统未启动而被跳过的可能性,这对不能保持不间断开机运行的个人用户比较有利。
我已经在脚本中加入了强制启动计划任务的代码,应该可以保证用得上计划任务吧?不知道在比较BT的设置中是否有效,还需要大家多作测试。
就算计划任务启动失败,但是已经加入了开机自动运行的代码,每次开机的时候还是能够运行备份脚本,可一定程度上弥补计划任务启动失败的不足。
目前觉得这是个双重保险的做法,老大可能还有更完善的方案,能不能透漏一下呢?
Originally posted by willsort at 2006-6-9 02:30:
Re namejm:
The advantage of the algorithm is that because it can adopt the task validity period mechanism, it can greatly avoid the possibility that "scheduled tasks" are skipped due to the system not starting, which is more beneficial to individual users who cannot keep the computer running uninterruptedly.
I have added code to force the startup of scheduled tasks in the script, which should ensure that the scheduled tasks can be used. I don't know if it is effective in relatively BT settings, and everyone needs to do more testing.
Even if the scheduled task startup fails, but the code to start automatically when booting has been added, the backup script can still run every time the computer boots, which can make up for the lack of scheduled task startup failure to a certain extent.
At present, this is considered a double insurance approach. The boss may have a more perfect solution. Can you reveal it?
|
|
2006-6-9 07:46 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 52 楼』:
使用 LLM 解释/回答一下
Re namejm:
例如,设定备份任务A在从1日开始每7天运行一次,但在1日这一天,用户从未启动系统,任务显然无法被执行;然后,假设用户在2日启动系统,此时是否需要执行任务A呢?作为备份任务来说,一般是需要的;再后,用户在3日再次启动系统,此时是否需要再次执行任务A呢?通常是不需要的。
这只是通常的情况,我们可能还需要照顾用户更复杂的需求。比如用户可以设定,任务过期1~2天则自动执行,过期3~4天则询问是否执行,过期5~6天则不再执行;而在过期的任务执行后,下一次任务执行时间是按新的周期是重新调整,还是保持原来的计时周期?
这些用计划任务将难以实现,除此而外,计划任务还有更多的缺陷,比如无法设定任务自系统启动时运行,无法设定任务在系统总运行时间达到一定时限时运行,甚至无法设定任务每4天或者每5天执行一次(并非每月的固定几天)。所以,我个人从不使用“计划任务”。
简而化之,定时定的是“时钟”,定期则定的是“期限”。至于何者更符合设计者的定位和使用者的需求,则是另外一个更复杂的问题了。
Re namejm:
For example, set backup task A to run every 7 days starting from the 1st. But if the user never boots the system on the 1st, the task obviously can't be executed; then, suppose the user boots the system on the 2nd, does the task A need to be executed at this time? As for a backup task, generally it is needed; then, the user boots the system again on the 3rd, does the task A need to be executed again at this time? Usually it is not needed.
This is just the usual situation, and we may also need to take care of users' more complex needs. For example, the user can set that if the task is overdue for 1-2 days, it will be executed automatically; if it is overdue for 3-4 days, it will ask whether to execute; if it is overdue for 5-6 days, it will not be executed; and after the overdue task is executed, is the next task execution time readjusted according to the new cycle or does it keep the original timing cycle?
These are difficult to achieve with scheduled tasks. In addition, scheduled tasks have more defects, such as being unable to set the task to run when the system boots, being unable to set the task to run when the total running time of the system reaches a certain limit, and even being unable to set the task to be executed every 4 days or every 5 days (not fixed days of each month). So, I personally never use "scheduled tasks".
In short, timing sets the "clock", and periodicity sets the "deadline". As for which one is more in line with the designer's positioning and the user's needs, that is another more complex issue.
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-6-9 18:33 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 53 楼』:
使用 LLM 解释/回答一下
对于每隔N天运行一次或者每次开机时运行一次的需求,可以改用XP及其之后的系统中的schtasks命令来实现。
看了此命令的介绍,感觉很是强大,但是功能强大的背后,是可选参数太多的弊端。如果把这个命令用于交互界面,必将使用户不停地作出选择,过多的干涉会增加用户的工作量,而我想使这个脚本尽可能地减少用户的操作,所以必然会舍弃一些功能。
当然,DOS不是万能的,我也没指望这个脚本能取代目前用各种高级语言编出来的备份程序,只是边学边用,看看批处理到底能替我节省多少重复劳动,给我带来哪些方面的方便等等。尽可能多地榨取批处理的血汗,则是我所孜孜以求的 
BTW,我相信这个脚本还有其他可供开发的功能,只是我目前还没想到而已,正在学习之中。感谢版主一直以来的指引,也希望你能继续关注下去。Thanks。
For the requirement of running once every N days or once every time the computer starts, you can use the schtasks command in XP and later systems to achieve it.
After reading the introduction of this command, I feel it is very powerful, but behind the powerful functions is the drawback of too many optional parameters. If this command is used in an interactive interface, it will definitely make users keep making choices, and too much interference will increase the user's workload. And I want to make this script minimize the user's operations, so I will definitely give up some functions.
Of course, DOS is not omnipotent, and I don't expect this script to replace the backup programs written in various high-level languages at present. It's just learning while using, seeing how much repetitive work batch processing can save for me and what conveniences it can bring, etc. Trying to extract as much as possible the efforts of batch processing is what I am eagerly seeking :P
BTW, I believe there are other functions that can be developed for this script, but I haven't thought of them yet, and I'm still learning. Thank the moderator for the guidance all the time, and I hope you can continue to pay attention. Thanks.
|
|
2006-6-9 19:39 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 54 楼』:
使用 LLM 解释/回答一下
Re namejm:
粗略翻阅了schtasks,它应该是XP下计划任务的全功能命令行接口,确实比at增强了不少。多谢兄的提示!
至于参数太多的问题,因为对备份任务来说很多参数可以取缺省值,真正要选择的项目不是很多,所以可以用代码简单的封装一下。
如果说,还有什么可以增强的地方,那就是备份的模式与命令行接口了。
目前,程序所采用的备份模式是差异备份,当然还存在其它的一些的备份模式,比如同步备份、增量备份等,这些模式用批处理也应该是可以实现的。
至于命令行接口则主要是为了简化任务脚本的设计,如果增加了更多的备份模式,则将备份代码写入任务脚本中则过于冗繁,而如果将代码写入宿主脚本中,在任务脚本中仅写入调用的接口,则任务脚本会简单得多;进而可以考虑直接将备份任务以命令行的形式写入到计划任务的命令行中,从而省略任务脚本的设计。
Last edited by willsort on 2006-6-10 at 18:48 ]
Re namejm:
Briefly flipping through schtasks, it should be the full-function command-line interface for scheduled tasks under XP, which is indeed a lot more enhanced than at. Thanks for the brother's tip!
As for the problem of too many parameters, because for backup tasks, many parameters can take default values, and the number of really selected items is not many, so it can be simply encapsulated with code.
If there is anything that can be enhanced, it is the backup mode and command-line interface.
The current backup mode adopted by the program is differential backup. Of course, there are some other backup modes, such as synchronous backup, incremental backup, etc. These modes should also be achievable with batch processing.
As for the command-line interface, it is mainly to simplify the design of task scripts. If more backup modes are added, writing the backup code into the task script is too cumbersome. And if the code is written into the host script, and only the calling interface is written in the task script, the task script will be much simpler; then we can consider directly writing the backup task in the form of a command line into the command line of the scheduled task, thus omitting the design of the task script.
Last edited by willsort on 2006-6-10 at 18:48 ]
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-6-10 18:47 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 55 楼』:
使用 LLM 解释/回答一下
Re willsort:
"进而可以考虑直接将备份任务以命令行的形式写入到计划任务的命令行中,从而省略任务脚本的设计。"
——我觉得如果这样做的话,那就脱离了我设计这个脚本的初衷:让用户不用记命令格式,只管按照提示做简单的输入操作就能完成备份。
另外,对于增量备份和同步备份,我不知道具体的概念是什么;还有,“宿主脚本”是什么意思?我是菜鸟,属于对比较专业一点的术语一看就晕菜的那种,别笑话我<img src="images/smilies/face-surprise.png" align="absmiddle" border="0">
Re:
"Then you can consider directly writing the backup task in the form of a command line into the command line of the scheduled task, thus omitting the design of the task script."
——I think if I do this, it will deviate from the original intention of my designing this script: allowing users to complete the backup without remembering the command format, just by following the prompts for simple input operations.
In addition, I don't know the specific concepts of incremental backup and synchronous backup; also, what does "host script" mean? I'm a newbie, the kind who gets confused when seeing more professional terms; don't laugh at me :o
|
|
2006-6-11 00:10 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 56 楼』:
使用 LLM 解释/回答一下
Re namejm:
关于备份模式请参考。
命令行接口是供备份任务所使用的,而非用户自己。也就是说,用户依据向导创建的备份任务,原来包括一个计划任务和一个对应的任务脚本,而这个脚本相对于文件备份器相对独立的。现在,我们可以让这个任务脚本,直接调用文件备份器中相应的备份模块。此时,因为任务脚本是由文件备份器生成的,而且其功能也是由文件备份器支持的,所以我称现在的文件备份器为“宿主脚本”。
极端简化的任务脚本将有只有一个命令行,而诸如检测、判断、备份、日志等任务全部交由宿主脚本来完成,而这个命令行是可以写到计划任务或者Run的键值中去的。而此时,任务脚本将不再存在。
为了恢复的备份
http://www2.ccw.com.cn/05/0528/b/0528b16_1.asp
Re: namejm:
For the backup mode, please refer to .
The command-line interface is for backup tasks, not for users themselves. That is to say, the backup tasks created by users according to the wizard originally include a scheduled task and a corresponding task script, and this script is relatively independent of the file backup tool. Now, we can make this task script directly call the corresponding backup module in the file backup tool. At this time, because the task script is generated by the file backup tool and its functions are also supported by the file backup tool, I call the current file backup tool the "host script".
An extremely simplified task script will have only one command line, and tasks such as detection, judgment, backup, and logging are all handled by the host script, and this command line can be written into the key values of the scheduled task or Run. At this time, the task script will no longer exist.
For backups for restoration
http://www2.ccw.com.cn/05/0528/b/0528b16_1.asp
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-6-12 18:53 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 57 楼』:
使用 LLM 解释/回答一下
看了"为了恢复的备份"一文,觉得还是差异备份好一点,因为我给这个脚本的定位是:只要满足个人用户备份重要的小文件就可以了,基本不考虑上百兆文件的备份。至于更复杂的备份模式,如果哪位有兴趣,可以自行开发,不一定用CMD命令。
关于“宿主脚本”的想法,我觉得要实现起来还是有点复杂,有点难度:如果要用任务脚本调用文件备份器中的相关模块,则文件备份器的位置和文件名必须固定不变;如果取消任务脚本,将命令写入at命令行或者注册表run中,则备份器中相关模块的变量该如何赋值才能得知要备份的是哪个文件,将要备份到什么地方去?
After reading the article "Backup for Restoration", I think differential backup is better. Because my positioning for this script is: it just needs to meet the needs of personal users to back up important small files, and basically does not consider backing up files of hundreds of megabytes. As for more complex backup modes, if anyone is interested, they can develop it by themselves, and it doesn't have to use CMD commands.
Regarding the idea of "host script", I think it is still a bit complicated and difficult to implement: if the task script is to call the relevant modules in the file backup device, then the location and file name of the file backup device must be fixed; if the task script is canceled and the command is written into the at command line or the registry run, then how to assign values to the variables in the relevant modules in the backup device to know which file is to be backed up and where it will be backed up to?
|
|
2006-6-12 23:04 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 58 楼』:
使用 LLM 解释/回答一下
增加了对日期和时间输入的错误检测,还不够完善,请各位高手指正。
感谢bagpipe提供代码。
Added error detection for date and time input, but it's not perfect yet. Please let experienced people correct it.
Thanks to bagpipe for providing the code.
|
|
2006-6-15 18:05 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 59 楼』:
使用 LLM 解释/回答一下
增加了一个比较实用的功能:从备份后的文件中恢复文件到原始目录处。
这个功能居然耗费了我几乎整整一天的时间,难点在于要把每个文件及文件夹及其对应的属性记录下来,然后再用attrib命令进行操作。一开始,我就要求自己不产生临时文件,结果无功而返,迫不得已,只好放宽要求,临时文件从3个减少到1个,终于把这个模块做出来了。
在做这个模块的时候,有了一些收获:比如,用for /r 遍历目录的时候,并不能用%~ai探测到隐藏文件的属性,但是在in后的括号中用dir /a /s /d之后,就可以完美地解决。
还是希望能不产生临时文件,希望能有高手来关注。
An added a relatively practical function: restoring files from the backed-up files to the original directory.
This function actually cost me almost a whole day. The difficulty was in recording the attributes of each file, folder, and their corresponding ones, and then operating with the attrib command. At the beginning, I required myself not to generate temporary files, but it was in vain. I had to relax the requirement, reducing the temporary files from 3 to 1, and finally made this module.
When making this module, I gained some insights: for example, when traversing the directory with for /r, the attribute of hidden files cannot be detected by %~ai, but after using dir /a /s /d in the parentheses after in, it can be perfectly solved.
Still hope to not generate temporary files, and hope that experts will pay attention.
|
|
2006-6-29 13:50 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 60 楼』:
使用 LLM 解释/回答一下
Re namejm:
目前,尚未观察到属性操作的必要性。xcopy可以选择复制属性,开关是/K,与此有关的开关还有/R和/H。
Re namejm:
Currently, the necessity of attribute operations has not been observed. xcopy can choose to copy attributes, and the switch is /K. There are also related switches /R and /H.
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-6-29 22:21 |
|
|