|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 91 楼』:
使用 LLM 解释/回答一下
Originally posted by uemuem at 2006-10-14 01:57:
在源文件不存在,备份文件存在的情况下,不能把备份文件恢复到源文件的位置,也没有提示出错。。。 ...
你这个问题我始终没能在我的机子上再现,暂时无法得知问题出在哪里,你最好多测试几次,如果还是不能恢复的话,请把你的每一步操作告诉我。
不过,倒是在测试的过程中发现,当复制某个子文件出错的时候,这个程序并不能完整地备份文件,至于在什么情况下会复制出错,暂时还不得而知;不过,复制出错的几率是非常低的,大可放心使用。
Originally posted by TQang at 2006-9-20 23:14:
xcopy_parameter参数没用上,是不是有点BUG
确实属于浪费变量的行为,已经修正,请在顶楼下载测试。
Originally posted by uemuem at 2006-10-14 01:57:
When the source file does not exist but the backup file exists, the backup file cannot be restored to the source file location, and there is no error prompt...
I have never been able to reproduce this problem on my machine, and I can't figure out where the problem is for the time being. You'd better test several times. If it still can't be restored, please tell me every step you take.
However, I did find during the test that when copying a certain sub - file fails, this program cannot fully back up the file. As for under what circumstances the copy will fail, it is still unknown for the time being; however, the probability of copy failure is very low, so you can use it with confidence.
Originally posted by TQang at 2006-9-20 23:14:
The xcopy_parameter parameter is not used, is there a bit of a BUG
It does belong to the behavior of wasting variables. It has been corrected. Please download and test on the top floor.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-10-19 22:09 |
|
|
wangjf
中级用户
  
积分 254
发帖 63
注册 2003-4-8
状态 离线
|
|
2006-10-21 07:32 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 93 楼』:
使用 LLM 解释/回答一下
Originally posted by wangjf at 2006-10-21 07:32:
无法下载附件
压缩包里包含了bat和exe两种格式,另外还有一个说明文件。测试了一下,发现可以下载,但是下载的文件无法正常打开,也无法正常删除,以前下载其他文件的时候也发现类似的问题,应该是论坛的下载系统出了问题,请换个时间下载,或者直接copy顶楼的代码。
Originally posted by wangjf at 2006-10-21 07:32:
Unable to download attachments
The compressed package contains both bat and exe formats, and there is also an instruction file. I tested it and found that it can be downloaded, but the downloaded file cannot be opened normally and cannot be deleted normally. I also found similar problems when downloading other files before. It should be a problem with the forum's download system. Please download at another time or directly copy the code in the top post.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-10-21 08:50 |
|
|
wangjf
中级用户
  
积分 254
发帖 63
注册 2003-4-8
状态 离线
|
『第 94 楼』:
使用 LLM 解释/回答一下
已经可以下载了,也可以正常打开.谢谢LZ的及时更新
It has been downloadable and can be opened normally. Thanks to the LZ for the timely update.
|
|
2006-10-21 21:52 |
|
|
andred0421
初级用户
 
积分 114
发帖 47
注册 2006-11-20
状态 离线
|
|
2006-11-24 15:28 |
|
|
ihouge
初级用户
 
积分 20
发帖 10
注册 2007-4-6
状态 离线
|
『第 96 楼』:
使用 LLM 解释/回答一下
感谢楼主共享!日后一定用得着
Thanks to the LZ for sharing! It will definitely come in handy in the future
|
|
2007-4-6 13:42 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 97 楼』:
使用 LLM 解释/回答一下
搁置了将近半年之后,再次更新代码。若没有什么大的bug,将作为final版推出,请有兴趣的测试一下。
After being suspended for nearly half a year, the code is updated again. If there are no major bugs, it will be released as the final version. Please test it if you are interested.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2007-4-9 00:23 |
|
|
yinghao2005
初级用户
 
积分 21
发帖 10
注册 2007-4-2
状态 离线
|
|
2007-4-9 04:38 |
|
|
flamey
初级用户
 
积分 152
发帖 74
注册 2005-12-1
状态 离线
|
|
2007-4-9 05:26 |
|
|
flyinspace
银牌会员
    
积分 1206
发帖 517
注册 2007-3-25
状态 离线
|
『第 100 楼』:
使用 LLM 解释/回答一下
说句实话,如果不加命令行参数,则这个脚本基本没有用。
To be honest, if there are no command-line arguments added, this script is basically useless.
|

知,不觉多。不知,乃求知 |
|
2007-4-9 07:53 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 101 楼』:
使用 LLM 解释/回答一下
Originally posted by flyinspace at 2007-4-9 07:53:
说句实话,如果不加命令行参数,则这个脚本基本没有用。
大错特错啊~最起码可以学习的啊
Originally posted by flyinspace at 2007-4-9 07:53:
To be honest, this script is basically useless without command-line arguments.
That's completely wrong~At least it can be learned.
|
|
2007-4-9 08:05 |
|
|
flyinspace
银牌会员
    
积分 1206
发帖 517
注册 2007-3-25
状态 离线
|
『第 102 楼』:
代码初步分析报告。
使用 LLM 解释/回答一下
set /p source= 请输入要备份文件的路径:
set "source=%source:"=%"
:: 上面这句为判断%source%中是否存在引号,有则剔除。
if "%source%"==":" goto input_source
if "%source%"=="0" exit
if "%source%"=="1" goto notice
if "%source%"=="2" goto backup_tasks
if /i "%source%"=="v" goto view_batch
if not exist "%source%" goto source_noexist
for %%i in ("%source%") do if "%%~fi"=="%%~di\" goto forbid_to_backup
:: 判断要备份的是文件还是文件夹,为以后的xcopy操作设置标志
pushd "%source%" 2>nul && (popd & set folder=yes) || (set folder=)
输入为空时,我们采用
if /i "%source%"=="" goto ***
if /i "%source%"=="%*" goto ***
这个来解决。。
这样,当目标不存在的时候。。
可以及时获取错误信息进行修正。。
另外,当被复制文件运行或被占用的时候。
楼主有没有考虑写入日志(给出提示)然后再继续或停止复制呢?
至于非法字符也非常好防御,写一个子程序。
利用 %data:~0,1% 类似的代码就可以搞定。。
楼主,请不要把这个做为最终代码吧:)
还有大量需要更新呢:)
呵呵,吃饭后再分析你的代码。
set /p source= Please enter the path of the file to be backed up:
set "source=%source:"=%"
:: The above sentence is to judge whether there are quotes in %source%, and if so, remove them.
if "%source%"==":" goto input_source
if "%source%"=="0" exit
if "%source%"=="1" goto notice
if "%source%"=="2" goto backup_tasks
if /i "%source%"=="v" goto view_batch
if not exist "%source%" goto source_noexist
for %%i in ("%source%") do if "%%~fi"=="%%~di\" goto forbid_to_backup
:: Judge whether the file to be backed up is a file or a folder, and set a flag for the subsequent xcopy operation
pushd "%source%" 2>nul && (popd & set folder=yes) || (set folder=)
When the input is empty, we use
if /i "%source%"=="" goto ***
if /i "%source%"=="%*" goto ***
This is to solve.
In this way, when the target does not exist.
You can get error messages in time for correction.
In addition, when the copied file is running or occupied.
Has the building owner considered writing a log (giving a prompt) and then continuing or stopping the copy?
As for illegal characters, it is also very easy to defend, write a subroutine.
Using code like %data:~0,1% can be done.
Building owner, please don't take this as the final code:)
There is still a lot to update:)
Hehe, analyze your code after eating.
|

知,不觉多。不知,乃求知 |
|
2007-4-9 08:37 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
|
2007-4-9 08:52 |
|
|
3391617
初级用户
 
积分 116
发帖 56
注册 2007-3-7
状态 离线
|
|
2007-4-9 10:19 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 105 楼』:
使用 LLM 解释/回答一下
1、 Originally posted by flyinspace at 2007-4-8 18:53:
说句实话,如果不加命令行参数,则这个脚本基本没有用。
从你的其他回帖可以看出,兄是编程中人,但是却说出这样的话,未免让人感到意外,试问:在面向对象的高级语言中,如果不提供对象的属性让你选择/修改,编出来的程序是不是个半身不遂的东西?这样的语言像不像被阉割过的太监?
2、
输入为空时,我们采用
if /i "%source%"=="" goto ***
if /i "%source%"=="%*" goto ***
这个来解决。。
这样,当目标不存在的时候。。
可以及时获取错误信息进行修正。。
可以说,判断输入是否为空是有好几种方法的,并且都能及时获取错误信息,比如还有 if not defined 语句。兄提供的方法在其他情况下确实可行,但是,兄可能没注意到上一标签段中的这个说明:
set source=:
:: 上面这句为后面去除引号做铺垫,冒号绝对不能省略;否则,当输入为空时按下回车会出错。
具体问题要具体分析,而不应只拘泥于固定的思维模式。
3、 另外,当被复制文件运行或被占用的时候。
楼主有没有考虑写入日志(给出提示)然后再继续或停止复制呢?
用重命名的方法似乎可以简单地判断文件是否在运行或被占用,不过,这个方法弊端很大:当要复制的文件比较多的时候,因为还要复原文件名,代码的执行效率会比较低下。在头几个版本中,我都会给备份后的文件加上"系统+只读"属性,到了这个版本,我已经取消了这个操作,执行效率问题也是其中的原因之一,所以,基于同样的原因,不打算增加这个功能。如果大家觉得有必要的话,在后续版本中将添加。
4、 至于非法字符也非常好防御,写一个子程序。
利用 %data:~0,1% 类似的代码就可以搞定。。
关于非法字符的防御,似乎并不像兄所说的那样简单,具体原因请参考本帖13楼 willsort 的分析。
5、 楼主,请不要把这个做为最终代码吧:)
还有大量需要更新呢:)
呵呵,吃饭后再分析你的代码。
对于兄的耐心分析,在此谢过,更多的不足需要包括像兄这样有耐心的人来测试才会发现得了(比如第3点)。但是,正如我在更新历史中所说的,如果这个版本没有太大的bug的话,我将不再更新代码,因为我目前的精力稍显有限,不能再对无关紧要的细节做更深入的考虑。
1、 Originally posted by flyinspace at 2007-4-8 18:53:
To be honest, if no command-line parameters are added, this script is basically useless.
From your other replies, it can be seen that you are a person in programming, but saying such a thing is somewhat unexpected. Let's ask: In an object-oriented high-level language, if the properties of the object are not provided for you to select/modify, is the program compiled a crippled thing? Does such a language resemble a castrated eunuch?
2、
When the input is empty, we use
if /i "%source%"=="" goto ***
if /i "%source%"=="%*" goto ***
This is used to solve. .
In this way, when the target does not exist. .
Error information can be obtained in time for correction. .
It can be said that there are several methods to judge whether the input is empty, and error information can be obtained in time. For example, there is also the if not defined statement. The method you provided is indeed feasible in other cases, but you may not have noticed this description in the previous tag segment:
set source=:
:: The above sentence is to lay the groundwork for removing quotes later, the colon must not be omitted; otherwise, an error will occur when pressing Enter when the input is empty.
Specific problems should be analyzed specifically, and should not be confined to a fixed way of thinking.
3、 In addition, when the copied file is running or occupied.
Did the landlord consider writing to the log (giving a prompt) and then continuing or stopping the copy?
The method of renaming seems to simply judge whether the file is running or occupied, but this method has great drawbacks: when there are many files to be copied, because the file name needs to be restored, the execution efficiency of the code will be relatively low. In the first few versions, I would add "system + read-only" attributes to the backed-up files. In this version, I have canceled this operation. The problem of execution efficiency is also one of the reasons, so for the same reason, I don't plan to add this function. If everyone thinks it is necessary, this function will be added in subsequent versions.
4、 As for illegal characters, it is also very easy to prevent, write a subroutine.
Using code like %data:~0,1% can be done. .
Regarding the prevention of illegal characters, it doesn't seem as simple as you said. For specific reasons, please refer to the analysis of willsort on floor 13 of this post.
5、 楼主, please don't take this as the final code :)
There are still a lot of updates needed :)
Hehe, I'll analyze your code after eating.
Thank you for your patient analysis. More deficiencies need to be discovered by people like you who are patient to test (such as point 3). However, as I said in the update history, if there are no major bugs in this version, I will no longer update the code, because my current energy is somewhat limited, and I can't make more in-depth considerations for irrelevant details.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2007-4-9 21:57 |
|