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-08-01 12:39
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » A question challenging DOS experts View 1,635 Replies 12
Original Poster Posted 2005-08-13 15:14 ·  中国 河北 沧州 联通
初级用户
Credits 55
Posts 23
Joined 2005-08-11 15:25
20-year member
UID 41558
Status Offline
How to automatically save and exit edit to the DOS program after entering edit and finishing writing the program. Simply put, in the DOS environment:
c:\edit 1.bat
Write the program to be written (already in edit)
Press alt+f-x to exit
Complete it all at once with a batch file without manual intervention. It's equivalent to an automatic demonstration.
Floor 2 Posted 2005-08-13 16:40 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
Let's see, does EDIT have command-line parameters, and then try the > and < redirection characters. It doesn't seem like a big issue..
Floor 3 Posted 2005-08-13 16:45 ·  中国 河北 沧州 联通
初级用户
Credits 55
Posts 23
Joined 2005-08-11 15:25
20-year member
UID 41558
Status Offline
#83 What I want is this step, I must enter the edit interface. But still thank you
Floor 4 Posted 2005-08-13 18:29 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 5 Posted 2005-08-13 18:57 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
I just now saw and understood your meaning, this can't be possible..
Because EDIT must ask for saving, if you don't save and exit, it will pop up a box..
No matter in which way you open EDIT, at this time the process is under the control of the EDIT program,..
It's impossible to change its steps, especially in DOS.
Floor 6 Posted 2005-08-13 19:25 ·  中国 山西 太原 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re xy2fengye:

  In my opinion, the significance of doing this is not very great, so its challenge is reduced.

  Because EDIT is not a tool for processing text streams. It has a typical window menu interface, and uses menu commands to implement text editing. This is one of its advantages, and of course it may be a disadvantage, but this is still a technological advancement.

  We need to control text editing through automated scripts. EDIT has never been a good choice, and it is even difficult to be an option. For this aspect, EDLIN.EXE, a tool launched earlier by MS, is more competent. It used to be the love of batch processing enthusiasts and had a status similar to DEBUG.EXE. Although it once disappeared, you can still find and run it on NT series platforms such as XP now. Maybe it can help you unexpectedly with your problem.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 7 Posted 2005-08-13 21:03 ·  中国 广东 广州 白云区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
To achieve the demonstration effect like the LZ, I thought of using KPUSH from the MSDOS 7.1 super boot disk. After a little test, it can be successful, but the shortcoming is that this demonstration has no delay effect, and the keyboard "action" is too fast, so that the edit interface flashes by in a flash.

I also had a small try on KPUSH in my previous post. In fact, the function of KPUSH is relatively powerful. It can send up to 127 characters into the keyboard buffer, and can simulate keyboard input at the command line. In the default state, the size of the keyboard buffer is 15 keys (can be regarded as 15 characters). Running kpush /e expands the buffer size to 127 keys. If the 1.bat file to be demonstrated by the LZ is not long, then these 127 keys are enough. Try the following commands:

kpush /e
kpush "edit 1.bat" 13 "@echo KPUSH demo program." 13 "@echo Returned to DOS prompt." /33 "xy"

Explain:

kpush /e -- expand the buffer size to 127 keys

There are many parameters in the second line. In fact, these parameters are all characters and keyboard scan codes for simulation input. Among them, ordinary strings must be enclosed in quotes (single or double quotes are acceptable). "13" is the ASCII code of the enter key. The following "/33" is the scan code of the Alt+F combination key. For function keys such as combination keys, F1-F12, etc., you must use "/" followed by the scan code to distinguish the ASCII code of ordinary keys. The "xy" at the end means that after pressing Alt+F, press "x" first. At this time, the edit prompts whether to save the file, and then simulate pressing the "y" key to exit. To query the code or scan code of a certain key, you can directly run KPUSH and then press any key to see the result corresponding to the key.

[ Last edited by JonePeng on 2005-8-13 at 21:05 ]
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 8 Posted 2005-08-13 21:13 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
The LZ doesn't want edlin. What he wants is Edit, for demonstration purposes, he wants to demonstrate to people how to use Edit to write a batch file (or other program).

Personally, I feel this is of no significance. If Edit supports macro functions similar to Office, this can be achieved. There are similar software under Windows, such as Automate. But under DOS, I haven't found any yet.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 9 Posted 2005-08-14 20:54 ·  中国 山西 运城 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re Climbing:

Instead of making automatic demonstrations of EDIT, it might be better to use a screen capture software to record the input process as a video or animation under the command line. Although it is a bit larger in size, it can avoid many compatibility issues, such as the situation where the environment does not support EDIT.

  But I don't know what screen recording software under DOS can directly record and generate self-display animations?
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 10 Posted 2005-08-14 21:31 ·  中国 河北 沧州 联通
初级用户
Credits 55
Posts 23
Joined 2005-08-11 15:25
20-year member
UID 41558
Status Offline
Hello everyone. The reason I came up with this topic is like this. Because sometimes we don't want to always use edit (if you never use it) to open it, write a program, save - exit - confirm exit. It's really a bit troublesome. If we make a batch file, isn't it simple and saves a lot of things? By the way, what tools do you use to write batch files in DOS?
Floor 11 Posted 2005-08-14 22:09 ·  中国 广东 汕头 电信
初级用户
Credits 24
Posts 20
Joined 2005-08-14 16:29
20-year member
UID 41651
Status Offline
Because EDIT will ask for saving; if you don't save, it will exit, and it will pop up a box. No matter in which way you open EDIT, you can't change its steps. Use DOS.
Floor 12 Posted 2005-08-14 22:39 ·  中国 山西 运城 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re xy2fengye:

  If you are referring to how to generate batch programs or text files in the command line or batch processing, you can refer to the following link:

  {16833}Several ways for dos commands to generate text files (*.txt)

  If you want to edit some files through batch processing, I still suggest using edlin, or using third-party provided tools such as sed. In addition, Debug also has a simple function to edit text.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 13 Posted 2005-08-16 10:45 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
I use Edit to write things under DOS. I think it's quite easy to use, and it doesn't make people feel troublesome at all. If you find it troublesome, it seems that Bart's tool disk provides an Edit program. That program can directly press Alt+X to save and exit, and Alt+Q to exit without saving. Also, there seem to be editing tools like Qedit or Vim.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Forum Jump: