China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 14:54
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] [XP] File Backup Utility V2.4 (Final) [Updated on 07-4-8] DigestI View 34,124 Replies 112
Floor 106 Posted 2007-04-09 22:58 ·  中国 广东 广州 海珠区 电信
银牌会员
★★★
Credits 1,206
Posts 517
Joined 2007-03-25 01:18
19-year member
UID 82819
Gender Male
Status Offline
Originally posted by namejm at 2007-4-9 08:57 AM:
  1、
  From your other replies, it can be seen that you are someone involved in programming, but saying such a thing is quite surprising. Let's ask: In an object-oriented high-level language, if you don't provide an object...

Oh, because you violated a characteristic of batch processing, which is simplicity and speed..

And adding parameters is exactly for such a purpose. Otherwise, I might as well use xcopy which is simpler.

After adding parameters, we can use

batch.cmd ……

In this way, the workload can be saved. The purpose of making batch processing is: to make work more efficient instead of more troublesome, which is why I have this statement.

Initially, I originally planned to propose using an.ini file.

Think about it, the first time we use it is for fun. The second time we use it is because the novelty hasn't worn off yet. Then for the nth time we use it, what reason do we have to trouble ourselves like this?

So, now as long as I am writing batch processing at the practical level, I all add parameters.

That's why this statement exists.
知,不觉多。不知,乃求知
Floor 107 Posted 2007-04-09 23:03 ·  中国 广东 广州 海珠区 电信
银牌会员
★★★
Credits 1,206
Posts 517
Joined 2007-03-25 01:18
19-year member
UID 82819
Gender Male
Status Offline
4、


Quote:
As for illegal characters, it is also very easy to defend. Write a subroutine.
Using code like %data:~0,1% can do the trick.



  Regarding the defense of illegal characters, it doesn't seem as simple as you said. For specific reasons, please refer to the analysis by willsort on floor 13 of this thread.

As for the source file, there is no need for us to complete these judgments in the batch processing.

Because Microsoft has considered these parameters at the beginning of design.

All we need to do is capture this kind of error.
知,不觉多。不知,乃求知
Floor 108 Posted 2007-04-09 23:56 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Re flyinspace 『Post 106』and 『Post 107』:

  I originally thought you meant that if you don't write so many parameters in the code, then this script is just a piece of junk. But from your two replies, I realized you meant you hope to be able to add parameters when calling the script. It seems I misunderstood.

  But the calling format of batch.cmd [source file] [target file] [switch] requires learning more parameters, and lazy novices like me will definitely be daunted. Using parameters is convenient for programmers, but a torture for ordinary users. So the original intention of me writing this script is: let users follow the prompts step by step, foolproof operation——I think no backup fanatic will use this script to back up files frequently several times a day? If there are a large number of backup operations or high backup requirements, it is recommended to use a dedicated backup program written in a high-level language, and this script is not recommended. Therefore, the positioning of this script determines its operation method.

  Because this script provides both manual input and mouse drag-and-drop methods. For the drag-and-drop method, there is no need to detect special characters at all, which I admit. But with manual input, it's difficult to ensure that users won't input special characters. For example, if redirect symbols are used in some places, it is very likely to overwrite important files; to be safe, it is necessary to detect special characters.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 109 Posted 2007-04-10 01:08 ·  中国 甘肃 平凉 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Actually, it's not necessary that every bat has to carry parameters.
Floor 110 Posted 2007-05-28 22:27 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Originally posted by willsort at 2006-5-24 02:47:
Re namejm:
The following statements can remove the possible quotes in the path, convert the relative path to the absolute path, convert the non-standard path to the standard path (C:\\-->C:\), and judge whether the path effectively exists and whether it is the root path. However, it still cannot resist the illegal characters (>|) in the path. I wonder if other brothers have any better ways?

  This problem has troubled me for a long time. I just found a relatively perfect solution now, that is: create a random folder in the %tmp% directory and leave the task of judging illegal characters to the operating system. However, what makes me a little unhappy is that this solution produces temporary files that I have always tried to avoid.

  For the specific code, please refer to this post: Batch processing to judge whether the input file name is legal
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 111 Posted 2007-06-01 14:18 ·  中国 北京 联通
初级用户
Credits 20
Posts 12
Joined 2007-06-01 12:47
19-year member
UID 89957
Gender Male
Status Offline
Floor 112 Posted 2007-06-27 17:41 ·  中国 山东 青岛 联通
新手上路
Credits 2
Posts 1
Joined 2007-06-27 17:15
18-year member
UID 92513
Gender Male
Status Offline
Good stuff, give it a support
Floor 113 Posted 2007-09-03 10:01 ·  中国 广西 南宁 西乡塘区 电信
中级用户
★★
Credits 259
Posts 164
Joined 2006-09-21 23:39
19-year member
UID 63296
Status Offline
Dare not even dare to look ^_^
‹ Prev 1 6 7 8
Forum Jump: