中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-11-10 16:54
47,815 topics / 349,930 posts / today 0 new / 48,291 members
DOS批处理 & 脚本技术(批处理室) » [Closed] setlocal EnableDelayedExpansion and "!"
Printable Version  10,588 / 25
Floor16 kcdsw Posted 2006-06-19 13:26
中级用户 Posts 179 Credits 404
Please provide the specific Chinese content that needs to be translated so that I can assist you with the translation.
Floor17 willsort Posted 2006-06-19 18:58
元老会员 Posts 1,512 Credits 4,432
Re: kcdsw:

Sorry! Your question was noticed by me soon, but unfortunately, I did many tests at that time and later, and the result proved that there are many problems in using the for+echo method to copy and edit text, especially for files like cover.ps which contain quite a lot of special characters.

So I was ready to change my approach and use other methods to edit text.

The first method that came to mind was edlin, because it is a command-line text editor built into the NT series. After going through some trouble, I found that edlin cannot handle extremely long files, and the file is only loaded up to more than 530 lines and then ends.

Then, the remaining path was only third-party script tools. Considering that it was just to replace some simple text, so sed was chosen, and its script is not cumbersome to write. The following code was tested with GNU sed 3.02, and the result was correct and efficient.



[ Last edited by willsort on 2006-6-20 at 10:31 ]
Floor18 kcdsw Posted 2006-06-20 10:15
中级用户 Posts 179 Credits 404


If written like this, is it just replacing the original 730 730?
If so, can I just get rid of the first for line?
Just need to extract the pixel size, then calculate the required new data and then replace?


Can you provide the download of the sed version you mentioned?

[ Last edited by kcdsw on 2006-6-20 at 10:29 ]
Floor19 willsort Posted 2006-06-20 10:30
元老会员 Posts 1,512 Credits 4,432
Re kcdsw:

That's right.

The first for statement in the original code was used when considering the for+echo and edlin solutions. After switching to the sed solution, since it doesn't affect the output result, it was overlooked to delete it. Similar statements also include setlocal.

Now the original code has been modified.

For the sed download link, please refer to . Please note that using GNU sed 4.0.7 will filter out the carriage return characters (0x0D) in the text lines and generate Unix - format text. GNU sed 3.02 doesn't have this problem.

GNU utilities for Win32
http://unxutils.sourceforge.net/

[ Last edited by willsort on 2006-6-20 at 10:39 ]
Floor20 kcdsw Posted 2006-06-20 11:33
中级用户 Posts 179 Credits 404
Hehe, thanks moderator.

Previously I was very stubborn to use batch processing, maybe it's my psychology playing tricks.
Always feeling that most external programs have no Chinese annotations, not written by myself, and also not at ease, difficult to learn and understand.
Today I used it and felt it's不错 (Note: "不错" here remains as it is since it's part of the original text and the task is to translate the Chinese parts. Wait, no, I made a mistake. The entire text needs to be translated. Let's start over.)

Hehe, thank you moderator.

Previously I was very stubborn to use batch processing, maybe it's my psychology playing tricks.
Always feeling that most external programs have no Chinese annotations, are not written by myself, and I'm also not at ease, hard to learn and understand.
Today I used it and felt it was good.

Wait, no, let's do it properly:

Original Chinese: 呵呵 谢谢版主

先前我很固执的要用批处理,可能是我的心理在做怪
总是觉得外来的程序大多没中文注解,也不是自己写的,也不放心,难学难懂
今天一用 感觉不错

Translation:

Hehe, thanks moderator.

Previously I was very stubborn about using batch processing, maybe it's my psychology playing tricks.
Always feeling that most external programs have no Chinese annotations, are not written by myself, and I'm also not at ease, hard to learn and understand.
Today when I used it, I felt it was good.
Floor21 kcdsw Posted 2006-06-20 11:37
中级用户 Posts 179 Credits 404
I used QuickBFC to compile.

When compiling, I bundled sed in.

Because when the compiled exe runs, it first needs to release the original bat file, and the location is %temp%.

I think the path where it releases the bundled file is probably also here, or the folder where the exe is located.

In this way, the exe will automatically pass the path of cover.ps to the bat and sed, which makes me more at ease, avoiding that sed and bat are not together. Avoiding me telling it the path of cover.ps, saving a lot of things!!!

Here, once again, I thank the moderator and all the brothers who paid attention to my post!!

Bow to you, little brother!!
Floor22 jianyaogao Posted 2007-03-17 23:34
初级用户 Posts 22 Credits 49
Floor23 hegu Posted 2007-05-13 12:31
新手上路 Posts 2 Credits 4
So many experts!!!!!! Admiring them....
Floor24 kgdetg1127 Posted 2007-10-12 22:23
初级用户 Posts 89 Credits 158
Awesome. Push it up.
Floor25 zhouyongjun Posted 2008-10-31 13:54
新手上路 Posts 3 Credits 4
Confusedly, download it and take a look.
Floor26 wujianlin555 Posted 2008-11-20 23:00
新手上路 Posts 1 Credits 1
Let me download and try it
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023