![]() |
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-08-14 03:51 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS学习入门 & 精彩文章 (教学室) » Repost: Clever Use of DOSKey |
| Printable Version 2,347 / 8 |
| Floor1 MYS | Posted 2002-10-25 00:00 |
| 元老会员 Posts 1,637 Credits 5,170 From 广东佛山 | |
|
Clever Use of DOSKey
DOSKey is a commonly used memory-resident program under MS-DOS. Its main functions are: recording typed commands in a memory buffer and turning command sequences into macros. DOSKey is usually added to the batch file AUTOEXEC.BAT, that is, add DOSKey or LH DOSKey to the command line in AUTOEXEC.BAT. You can also type DOSKey or LH DOSKey directly under MS-DOS to start it. After DOSKey is installed, you can conveniently and quickly find, use, and modify commands typed previously. Below is a brief introduction to several ways to use DOSKey: First: Find, display, and edit a DOS command: For commands just typed, you can use the ↑ or PageUP and ↓ or PageDown keys to find them; for commands typed earlier, you can use F7 to display the command list, then use F9 to enter the number of the command in the list. While searching, DOSKey allows you to edit and modify the current command line by moving the cursor with the ← and → keys. During editing you can also use the Insert key to switch between character insert and overwrite modes. Second: Enter multiple commands at the same time: Using DOSKey, you can type multiple commands on the same command line, separating each command with "Ctrl + T". The command format is: DOSKey command1 "Ctrl + T" command2 "Ctrl + T" command3 For example, at the DOS prompt type: C:\>cd mydocu~1 "Ctrl + T" dir *.doc/w "Ctrl + T" dir *.xls After pressing Enter, the three commands entered will be displayed and executed in sequence. Third: Create a batch file: Everyone knows that batch files can be created with copy con:, Edit, and other methods. Now let me tell everyone that for some not-too-long batch files, they can also be created entirely with DOSKey. This method uses DOSKey's /history command to input the records in the list into a BAT file. First, press "Alt + F7" to clear the record buffer in memory; then type the required batch contents. For example, at the DOS prompt type: C:\>CLS C:\>CD \WINDOWS\TEMP C:\WINDOWS\TEMP>SUBST B: . C:\WINDOWS\TEMP>CD.. C:\WINDOWS>DOSKey /history > setb.bat This saves the above commands in setb.bat. Finally, use a text file editor (such as: EDIT) to delete the last line, "DOSKey /history >setb.bat". After that, as long as you run setb.bat, you can create a virtual B drive. Fourth: Use DOSKey to create macros: With DOSKey, you can create some commonly used groups of DOS commands as a macro. The command format is: DOSKey name(macro name)=command1 $t command2 $t etc.,(command group) Each command in the command group is separated with $t. For example, type: C:\>DOSKey aut=dir *.exe/p $t dir *.com/p $t dir *.bat/p Press Enter. Later, you only need to type aut to display all executable files in the current directory. Macros can also use replaceable parameters like batch files; the parameter is $n, where n=1~9. For example: C:\>dos key hmy=md $1$t cd $1 This macro replaces the two DOS commands md and cd. You only need to use hmy Content(directory name) to create a directory and enter that directory at the same time. Since macros are stored in memory, they will be lost after shutting down. However, you can add these commonly used macros to the command line in AUTOEXEC.BAT, which will make them very convenient to use in the future. DOSKey also has many options and command editing keys. If you need detailed information, you can type DOSKey/help or DOSKey/? to query. |
|
| Floor2 hit | Posted 2002-10-26 00:00 |
| 初级用户 Posts 148 Credits 688 From 陕西 | |
| Floor3 中华dos | Posted 2002-10-26 00:00 |
| 初级用户 Posts 3 Credits 107 | |
|
Good! Impressive, such a tiny doskey actually has so many uses.
|
|
| Floor4 noah183 | Posted 2004-12-06 00:00 |
| 初级用户 Posts 4 Credits 122 | |
|
Although this is a very old post, I still think it was really worthwhile; after reading it I learned quite a lot
|
|
| Floor5 defrag | Posted 2004-12-19 00:00 |
| 中级用户 Posts 570 Credits 456 | |
|
|
|
| Floor6 lfdjssz | Posted 2005-10-20 21:09 |
| 初级用户 Posts 72 Credits 125 | |
|
Good! Impressive, such a tiny doskey actually has so many uses.
|
|
| Floor7 maya0su | Posted 2005-10-31 17:33 |
| 中级用户 Posts 131 Credits 241 | |
|
Actually DOSKEY can also have many uses under WIN's GUI. Its functions are very powerful; it mainly depends on how you use it!
|
|
| Floor8 wlzxianfei | Posted 2005-11-06 10:28 |
| 新手上路 Posts 9 Credits 18 | |
|
Really impressive! I want to learn too! I don't know much about DOS, but I want to learn. Please give me more guidance! Thanks!
|
|
| Floor9 220110 | Posted 2005-11-06 20:34 |
| 荣誉版主 Posts 313 Credits 718 | |
|
I’ll add a few examples:
1。Use DOS macros to extend the functions of the DIR and CHKDSK commands: DOSKEY DIRNAME =DIR /ON /P (sort the current directory by name) DOSKEY DIREXNAME= DIR /OEN /P (sort the current directory by extension) DOSKEY CHKDSKM =FOR %I IN (C:D:E:F:) DO CHKDSK %I (automatically run the CHKDSK command on multiple drives) 2,The CLUSTER macro displays the cluster size: DOSKEY CLUSTER =CHKDSK $b | FIND “EACH” 3,Each time DEL is used, the user must confirm again: DOSKEY DEL =DEL $1 /P PS: To create macros, DOSKEY must first be loaded into memory. |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |