Enhanced DOSKEY.com
--- Freeware ---
[page last modified 2018-04-14]
This program is an enhanced, drop-in replacement for the DOSKEY.COM that ships with MS-DOS and Windows 9x/Me. Although enhanced, it has a smaller disk and memory resident footprint. It is a great addition to DOS boot diskettes, and to the Win 9x/Me environment if the DOS box is used frequently. Note: will not operate under Windows NT/2000/XP (it's not needed since those systems have completion mechanisms built-in).
The primary added feature is command and file "auto-completion" via the tab key. Depending on the context, either a matching command or filename (or path) will be supplied. This is a huge timesaver when using the command line.
In the following examples user-entered text is in CAPS and the auto-completed text which appears when the user enters a TAB key -- is in italics. The "_" represents the cursor position after auto-completion:
c:\> XCopy.exe
_
c:\> CD
\Windows\_
c:\> DIR Autoexec.bat
_
If there is more than a single matching completion, the user can repeatedly press the TAB key to cycle through the matches as they appear on the command line. Entering <shift>TAB will go backward through the list of matches (if, for example, you pressed TAB one too many times).
To install, rename your existing DOSKEY.COM (to save it) and download the replacement. To remove, delete the downloaded DOSKEY.COM and rename your original back to DOSKEY.COM.
[Note to Windows/ME users: the "System File Protection" feature in this OS guards against a direct replacment of DOSKEY.COM -- install and load the enhanced DOSKEY.COM from another directory of your choice, and don't rename the Windows/Me original.]
Hope you like it. I wrote this many years ago to make the DOS command line easier to use, and still find myself relying on it every day.
Version history
4/14/18 - Wengier Wu has provided a Doskey version 2.8. Mr. Wu can be contacted at wengierwu domain yahoo.
The changes from 2.7c: 1) The "DOSKEY /?" command now shows help information one screen at a time when it does not fit on the screen all at once (e.g. with the standard 25-row screen). 2) Improved display for the DOSKEY current settings when the "DOSKEY /V" command is invoked. 3) Cleaned up the documentation and fixed minor bugs.
Click here to download with full source doskey28.zip
7/20/17 - Wengier Wu has provided a Doskey version 2.7c. Mr. Wu can be contacted at wengierwu domain yahoo.
The changes from 2.7b: 1) Enhanced DOSKEY will now display a warning message if the DOS version is found to be 4.x or below -- DOS 5.0+ is required; 2) DOSKEY.TXT is now the main manual for Enhanced DOSKEY; README.TXT includes updated package information.
Click here to download with full source doskey27csrc.zip
7/9/17 - Wengier Wu has provided a Doskey version 2.7b. Mr. Wu can be contacted at wengierwu domain yahoo.
The changes from 2.7a: 1) Improved LFN handling for systems where LFN support is only available on certain drives but not others; 2) Improved support for special drive letters ([: and ]:) in SFN mode (e.g. LASTDRIVE=32 in DOS 7's CONFIG.SYS).
Click here to download with full source doskey27bsrc.zip
7/1/17 - Wengier Wu has provided a Doskey version 2.7a. Mr. Wu can be contacted at wengierwu domain yahoo.
The changes from 2.7: 1) Fixed minor bug when the auto-case conversion is enabled with /l or /p option
Click here to download with full source doskey27asrc.zip
6/27/17 - Wengier Wu has provided a Doskey version 2.7. Mr. Wu can be contacted at wengierwu domain yahoo.
The changes from 2.6b: 1) The auto-case conversion (/L or /P) is now also compatible with DBCS (Chinese/Japanese/Korean) file names on DBCS-enabled systems; 2) New README.TXT file as the main documentation for Enhanced DOSKEY.
Click here to download with full source doskey27src.zip
6/26/17 - Wengier Wu has provided a Doskey version 2.6b. Mr. Wu can be contacted at wengierwu domain yahoo.
The changes from 2.6a: 1) Fixed an issue in SFN mode that file completion might not work as expected when the path is very deep. 2) Fixed an issue in command option parsing introduced in version 2.6.
Click here to download with full source doskey26bsrc.zip
5/28/17 - Wengier Wu has provided a Doskey version 2.6a. Mr. Wu can be contacted at wengierwu domain yahoo.
The changes from 2.6: This version fixes a rather small bug in Enhanced DOSKEY 2.5/2.6. The issue is mostly cosmetic and does not affect its actual functionality. Also (1) msbuild.bat (Microsoft tool build) removed as it no longer produces a binary-identical result -- use jwbuild.bat to create the executable; (2) jwbuild.bat comments were changed to indicate Jwasm v2.11 is required -- earlier versions of Jwasm will fail during compilation.
Click here to download with full source doskey26asrc.zip
5/16/17 - Wengier Wu has provided a Doskey version 2.6. Mr. Wu can be contacted at wengierwu domain yahoo. His comments:
The changes from 2.5 include: 1: Commands like C:\<PATH>\<PROGRAM> should now execute as expected even if you have defined macros like C=CREBOOT previously. 2: New options /L and /P for Enhanced DOSKEY to auto-convert letters to lower and upper cases respectively in both SFN and LFN modes. To disable such auto conversions, just specify both /L and /P options for Enhanced DOSKEY (e.g. DOSKEY /L /P), which is the default as in version 2.5.
Click here to download doskey26.zip
Click here to download with full source doskey26src.zip
8/26/14 - More thanks to Wengier Wu, who has provided a further enhanced Doskey version 2.5. Mr. Wu can be contacted at wengierwu domain yahoo. His comments:
Due to the fact that the last public release (i.e. DOSKEY 2.2) was not yet LFN feature complete (for example, it lacked the ability to auto-insert quotation marks when there are spaces within LFN), I had made further updates to it which should, presumably, completely solve such issues by now. In addition, I have also added a number of other features that I considered to be very useful. These features are not necessarily limited to LFN support, or even to Tab Completion, but may instead relate to other features of Enhanced DOSKEY such as macro support. Some of such features were already in the "Stuff to do" list of the source code for a few years, like auto-translation of "macro=[text]" to the "doskey macro=[text]" functionality and the redefinition of the F1-F12 function keys, which are now implemented. Because of the number of new features that are introduced in this version, I have increased the version number to 2.5. It should be considered stable, since it had been more or less actively used/tested by myself during the last month, and it had also been tested by another user (to whom I had also made discussion of some new features). Of course, since it is not possible for me or the other user to test all possibilities, bugs can still exist and bug reports made by anyone are certainly welcome. However, after all these testings I can confidently say that even if they do exist they should only been relative minor ones, or only occur in some very rare cases. Indeed, this DOSKEY 2.5 has not only been tested in English DOS/Win9x systems, but also in French and German DOS or Win9x systems, as well as Chinese/Japanese/Korean DOS/Win9x systems for DBCS (double-byte character set) support. Below is the detailed changelog from version 2.2: 1. Support the use of the ALT+F5 shortcut to toggle LFN support. Press ALT+F5 to disable LFN support if it is enabled, and press ALT+F5 again to enable LFN support if it is disabled. Except for the effect of toggling, they are functionally equivalent to options -D and -E respectively, but will be achieved faster and more easily once DOSKEY is installed. This shortcut is useful for example when trying to temporarily using certain (mostly older) programs that do not understand LFN at all. Otherwise it is generally not recommended to disable LFN support because DOSKEY will automatically fallback to short file names when LFN API is not available; 2. Full support the use of quotation marks ("") either when LFN is available or when the DOS version is found to be at least 7 (unlike MS-DOS 6.xx or earlier, MS-DOS 7+ understands quotes even if DOSLFN is not loaded). In such cases Tab completion will automatically identify, add and/or even change/remove/reformat (the latter three in CHANGE mode, see below) quotation marks when necessary. The most useful utilization of this feature is probably the ability to automatically insert quotes when necessary (i.e. when there are spaces or some other special characters in the file name), especial in LFN, but since MS-DOS 7+ supports spaces in short file names as well, DOSKEY can now handle this case too. If DOSKEY is used in MS-DOS 6.xx or earlier without LFN support then the quotation marks will not be supported because commands in these systems do not understand quotes anyway; 3. New CHANGE mode (use -C option to turn it on), which will automatically change the command/file name the user has typed in to match the actual name (e.g. "win" and "progra~" will be changed and completed to be "WINDOWS" and "Program Files" respectively). In CHANGE mode quotation marks will also be automatically changed/removed/reformatted when necessary. Use -A option to convert back to the APPEND mode, which only appends characters (which is the default and it is also the only supported mode in all earlier versions of Enhanced DOSKEY), or use the ALT+F9 shortcut to toggle between APPEND mode and CHANGE mode. But note that since in APPEND mode DOSKEY is not allowed to change anything that the user has already typed, unlike in CHANGE mode, the opening quotation mark will be inserted at the current cursor location when it is necessary to add quotes for file names with spaces or other special characters AND the user has not add a quote manually. Quotes within the middle of file name are perfectly fine supported by DOS/Win9x systems that understand quotes, as long as characters such as spaces have been properly quoted; 4. Added support for including system and hidden files or directories in Tab completion. DOSKEY 2.2 and earlier versions always exclude system and hidden files or directories, but now the user can use -S option to includes them. Use -N option to exclude them again, which is the default, or the user can use the ALT+F11 shortcut to toggle the inclusion of system and hidden files; 5. If the command entered are CD/MD/RD (or CHDIR/MKDIR/RMDIR), then its arguments that Tab completion will complete are limited to directories (not files), unless they have been redefined as macro names. This is very similar to the feature existed in Command Prompt in recent versions of Windows (NT family of Windows); 6. Support the use of Ctrl+Tab key to directly enter into a directory instead of looping into the next same level directory (as will be done by the Tab key); 7. Support the use of F11 key to show all matching commands or file names from the current command line. This feature can be very handy for use with Tab completion; 8. Support any command buffer length between 128 and 255. Probably all earlier versions of Enhanced DOSKEY only work with the default length of 128, but in MS-DOS 7+ the user can use the /U option of COMMAND.COM to specify any command buffer length between 128 and 255 (e.g. SHELL=C:\COMMAND.COM /P /U:255 in CONFIG.SYS). Now DOSKEY fully supports this as well. This feature was requested by a user; 9. Now commands in the format "macroname=xxx" (without quotes) are supported and have the same functionality as "doskey macroname=xxx" (i.e. defining macro with the name "macroname" to value "xxx") once DOSKEY is installed, but it is shorter and also faster because it will directly operate in memory instead of re-loading the executable. This can be very convenient for users who work with DOSKEY macros; 10. Implemented function key=macro logic (allow func key redefinition). Valid function keys are from F1 to F12. For example, after defining the macro "f1=dir $*" and pressing the F1 key, DOSKEY will display "f1 " and wait for the input of optional arguments. On the other hand, defining "f1!=dir" (with a "!" after "f1") will cause the dir command to be executed immediately after pressing the F1 key. If both macros are defined, the latter (the one with a "!" sign) will take precedence; 11. Added support for $0 in macro definition which resembles %0 in batch file, in addition to $1-$9 which resemble %1-%9 in batch files respectively; 12. Added support for "?" and "*" wildcards in Tab completion. "?" will match one character, this includes support for double-byte characters as well, which are used in East Asian (Chinese/Japanese/Korean) versions of DOS/Win9x systems with LFN support, and it has been tested on such systems in addition to western versions of DOS/Win9x. The other wildcard "*" will match any number of characters, but due to the special functionality of this wildcard the APPEND mode and CHANGE mode will handle it differently. In CHANGE mode the auto-completion will change wildcards into actual names, but in APPEND mode the auto-completion will only append "*.*", ".*" or "*" when necessary if the user has already typed a "*" wildcard in the command line (possibly in the middle of the partial file name) and there are matches in such cases. This is because of the functional differences between the two modes, and again the fact that DOSKEY is not allowed to change anything that the user has already typed when APPEND mode is being used, unlike in CHANGE mode. If the "*" wildcard is the last character that the user typed and LFN support has been enabled, there is probably no need for auto-completion to append anything (in APPEND mode) because the "*" wildcard will match the dot too when LFN is available, unlike in the short file name only mode. Note that some DOS commands such as CD do not support wildcards in their arguments, so it is recommended to use CHANGE mode instead of APPEND mode when trying to combine these commands with wildcards, since in CHANGE mode the Tab key will automatically convert wildcards into actual names; 13. Added distinctions among characters that are 1) allowed in both LFN and short file names, 2) characters only allowed in LFN and don't need to be quoted, 3) characters only allowed in LFN and needed to be quoted, and 4) characters that are not allowed in either LFN or short file names. Note that the pipe char ("|") and the backslash ("\") are special cases; while they are usually considered to be separators instead of actual file/dir name chars, they are in fact valid file/dir name characters in both LFN and short file names when used as the second byte of a double-byte character in a DOS/Win9x system that can handle them. Similar for the "[" and "]" chars, which are otherwise only valid in LFN. Now DOSKEY supports the handling of all these cases when using such systems; 14. Added support for the BackSpace and other editing keys such as LEFT/RIGHT/DELETE to delete or move between double-byte characters consisting of two bytes in addition to regular single-byte characters on double-byte enabled systems (Chinese/Japnese/Korean versions of DOS/Win9x). Note that this is actually the default behavior for the BackSpace key on such systems when DOSKEY is not installed, but (probably all) earlier versions of Enhanced DOSKEY incorrectly changed this behavior when used on these systems. Similarly, the keystorke overwrite/insert function and Tab completion are now compatible with double-byte characters on these systems too; 15. Added option -V to display current DOSKEY settings, such as the current BUFSIZE and whether LFN support has been enabled or not, and so on; 16. Rewrote the handler for enabling/disabling the Win95 QueryClose function for better compatibility. Now it will directly check the Windows version (at least 4) at command line start runtime, instead of checking DOS version and if Windows 3.x/9x API is present at DOSKEY loading time, because the latter approach would fail if DOSKEY is loaded before Windows 9x GUI starts (in such case QueryClose would not function at all), or if the user is running Windows 3.x on DOS 7+, but Windows 3.x does not support the Win95 QueryClose function. When running in real-mode DOS 6.x or 7.x in virtual machines DOSKEY will still run at 0% CPU when DOS is idle and power management software such as DOSIDLE.EXE is installed; 17. Fixed some bugs that probably existed in most (if not all) earlier versions of Enhanced DOSKEY, such as a bug in command option handling and another bug relating to the macro; 18. Some other smaller changes or bugfixes.
Click here to download doskey25.zip
Click here to download with full source doskey25src.zip
7/24/14 - Thank you to Wengier Wu, who has provided a modified Doskey with source enhanced to support long file names. I have not tested this code (I no longer have the ability to run DOS, or any 16-bit code). I did look at the source changes to insure they were benign, and verified the executable was built from the source. If you have questions or comments about the LFN implementation, Mr. Wu has permitted a contact email address to be posted: wengierwu domain yahoo. His comments:
I decided to go ahead myself to modify your DOSKEY 2.0 source code and finally managed to add LFN support into it, and tentatively named it as version 2.1. This DOSKEY 2.1 will use LFN API whenever possible (e.g. under MS-DOS 7 + DOSLFN or in a Win9x DOS window), or will fallback to 8.3 names if LFN API is unavailable (e.g. on real-mode MS-DOS 6.x or 7.x without DOSLFN). By now I have tested it and worked under the following environments: 1. Real-mode MS-DOS 6.22 boot disk (8.3 filename only) 2. Real-mode MS-DOS 7.10 + DOSLFN 0.41c (supporting LFN) 3. Windows 95 DOS window (supporting LFN) 4. Windows 98SE DOS window (supporting LFN) I have not tested extremely long file names though, and it also won't automatically add quotation marks ("") when there are spaces in the long file name. Unlike DOSKEY 2.0, this DOSKEY 2.1 will not convert the appended partial file/dir names into lower case, but instead will append the partial names exactly as they are stored in the disk (e.g. Windows98SETUP.exe). I have further updated DOSKEY to version 2.2. Major changes from version 2.1 are: 1. Added options /D and /E to disable and enable LFN support per user request (LFN enabled by default, as in version 2.1). 2. Bugfix: When LFN is available and user entered partial file/dir name that only matches 8.3 filename but not LFN (e.g. when typing WINDOW~1 instead of WINDOWS98), the completed file/dir name was not correct. Now it will be expanded to a complete 8.3 filename (e.g. WINDOW~1.EXE) in this particular case. 3. Increased default buffer size to 640 reflecting an increase of file/find buffer for better support for long path names. 4. Other minor changes relating to LFN.
Click here to download doskey22.zip
Click here to download with full source doskey22src.zip
5/28/17 - Version 2.0a provided by Torsten Kühn: I have merged Wengier Wu's one-letter macro-fix from Enhanced DOSKEY 2.6 into the 2.0 sources. This change is diminuitive, only two bytes differ, but in order to indicate the change from Paul's original build, I've named it "2.0a" (which increases the binary's size by one byte, the memory usage is still 3968 byte). Drive letter changes now perform properly, notwithstanding DR-DOS/MS-DOS/ PC DOS-DOSKEY's one-letter macro definitions like C=CREBOOT, D=DOSKEY /M or E=EXIT.
Click here to download with full source doskey20asrc.zip
6/29/09 - Version 2.0: Further small change to improve CPU utilization when idle (at DOS prompt) in a Virtual Machine. No other functional difference. (As of 9/11/2011, an additional archive with full source is available.)
Click here to download doskey20.zip
Click here to download with full source doskey20src.zip
6/14/09 - Version 1.9: Stop executing Win 95 interrupt on versions of DOS that do not implement it. Though never functionally a problem, this change allows doskey to run at 0% CPU (when idle) in Virtual Machines running DOS 6.x, when paired with power management software such as DOSIDLE.EXE.
Click here to download doskey19.zip
10/22/03 - Version 1.8: Caused high ASCII (>=80h) to be recognized as filename/path characters. Fixes a problem where umlaut chars were being viewed as separators instead of parts of a valid filename.
Click here to download doskey18.zip
9/26/03 - Version 1.7: Removed "\" at end of directory name when user exits tab completion with a space -- this functions better with commands such as MOVE, REN and COPY which object to a trailing "\" on the source.
Click here to download doskey17.zip
1/22/03 - Version 1.6: Fixed tab completion bug writing past end of command line. Removed "\" at end of input line when user exits tab completion with a CR -- this functions better with commands such as CD, RD and COPY.
Click here to download doskey16.zip
10/18/02 - Version 1.5: Added basic emacs compatible control sequences.
Click here to download doskey15.zip
10/15/02 - Version 1.4: Fixed bad command line parsing (switches could damage macro definitons, -m did not work).
Click here to download doskey14.zip