-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMDread.txt
More file actions
864 lines (634 loc) · 31.8 KB
/
Copy pathCMDread.txt
File metadata and controls
864 lines (634 loc) · 31.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
CMDread
Copyright 2006-13 Jason Hood
Version 2.12. Freeware
Description
===========
CMDread enhances the normal command line editing of CMD.EXE. It provides
more editing functions and improved file name completion, along with key-
board shortcuts to most items on the Edit menu. Symbols and macros can run
frequently used command lines and its own associations can run console-
specific programs. Macros can also be used to record and play back a seq-
uence of keystrokes.
Requirements
============
Windows 2000 or later.
Usage
=====
Running "CMDread" will install CMDread into its parent process (typically
CMD.EXE, but it may also work with other command processors). Usually,
though, you will use "-i" to start it with every instance of CMD.EXE. If
it's already installed, "CMDread" by itself (without any options) will
display the running status.
Upgrading
---------
Run "CMDread -i" (and/or "CMDread -I" as admin) to reflect the new name.
Delete "cmdkey.*" except for "cmdkey.{cfg,hst}".
Options
-------
There are numerous options to control CMDread's behaviour. Briefly:
-b disable backslash appending for completed directories
-c swap insert and overwrite cursors, or set their size
-e searching history will move the cursor to the end
-f specify/disallow history file
-g silent mode
-h number of commands to remember
-i install
-k disable colouring, or set colours
-l minimum line length to remember
-o default overwrite mode
-p set character to disable translation for the current line
-q set character to update the line in history
-r default auto-recall mode
-t disable translation
-u uninstall
-z disable CMDread
-_ treat underscore as punctuation, not part of a word
Options can also start with "/" and may be combined (e.g.: "-c /o", "/c/o"
and "-co" are all equivalent). An option may be prefixed with "-" or "+"
to explicitly set its behaviour, otherwise it toggles (e.g.: "-o" will
toggle between insert and overwrite modes, "--o" will set insert mode and
"-+o" will set overwrite mode). Except for "-z" all these options apply to
every instance of CMDread.
-b - Backslash appending
When completing a directory CMDread will normally add a backslash (or slash
if that's what you've used) after it ("dir" --> "directory\"). Use this
option to prevent that (like CMD.EXE, "dir" --> "directory").
-c - Cursor
The default insert cursor size is 25% of the font height and the overwrite
size is 50%. This option will swap those values, making insert 50% and
overwrite 25%. Alternatively, it can set the cursor sizes: "-c75,100" will
make the insert cursor 75% and the overwrite 100%. It is possible to set
one without the other: "-c75" will make insert 75%, leaving overwrite at
50%; "-c,100" will make overwrite 100%, leaving insert at 25%.
-e - Move to end
Searching the history for a matching command will normally leave the cursor
where it is (i.e. at the common prefix); this option will move it to the
end, like the history movement commands.
-f - History file
The "primary" instance of CMDread will save its history to this file when
CMD.EXE exits and restore it when next run. The default is "CMDread.hst"
in %USERPROFILE%; if no file is specified, the history will not be saved
(i.e. without "-f" it will save to %USERPROFILE%\CMDread.hst; with "-f" it
will not save history; and with "-fFILE" it will save to FILE). The pri-
mary instance is the first one to load, or the next one loaded after the
first one exits. If you've chosen to remember every line, "only" the last
1000 will be saved.
-g - Silent
Certain operations will beep to let you know something has happened (e.g.
going through all the completed file names). Use this option to suppress
the beep and make CMDread quiet.
-h - History size
This option sets the number of command lines CMDread will remember in its
history. The default is 50; it may be set to between 0 and 255, inclu-
sive, with 0 meaning it will remember every line.
-i - Install
Use this option to make CMDread permanent. It will append itself to
CMD.EXE's AutoRun registry setting, so every time CMD.EXE runs it will also
run CMDread. This option also has the effect of making the current options
the new defaults. Normally it installs for the current user; use -I to
install for the local machine (if permissions allow).
-k - Colours
CMDread can (and, by default, does) spice up the command line with a bit of
colour. This option can turn off the colours, or set the colours you would
like to use:
-kcCMD - the command line itself
-kmSEL - selected text
-krREC - recording a macro
-kdDRV - prompt's drive letter and colon
-ksSEP - prompt's path separators
-kpDIR - prompt's directories
-kbBASE - prompt's base directory
-kgGT - prompt's greater-than sign
Each uppercase sequence above is a one- or two-digit hexadecimal number
(see CMD.EXE's own COLOR help). The prompt colours are only for the usual
$P$G prompt (any other prompt will remain uncoloured); the base directory
is the final directory component. The default colours are "-kc1f -km79
-kr1b -kd1b -ks1e -kp1a -kb1a -kg1e" which is blue background, bright white
command line, bright blue on grey selection, bright cyan recording and
drive letter/colon, bright yellow separator and greater-than sign and
bright green directory components. Try using "-kp12" to see the effect of
the base directory.
-l - Length
Lines smaller than a certain length can be excluded from being added to the
history by using this option. The default is 1 (remember all lines) and
the maximum is 255.
-o - Overwrite
CMDread usually functions in insert mode, where current characters are
pushed aside to make room for new characters. This option sets overwrite
mode, where current characters are replaced by new ones.
-p - Ignore character
Starting a line with the character specified by this option will cause
CMDread to ignore its usual translations and leave the line unmodified.
The default character is space.
-q - Update character
Starting a line with the character specified by this option will cause
CMDread to replace the current line in history, rather than creating a new
one. This character must be first; ignore character (above) and dosify
(see below) must come after. This character also reverses the effects of
the Enter/UpdateEnter and StoreErase/UpdateErase functions (see below).
-r - Auto-recall
Auto-recall automatically searches the history as each character is
entered. This option will enable it by default.
-t - Disable translation
Prevent CMDread from applying its usual translations.
-u - Uninstall
Remove the AutoRun entry added by "-i" ("-U" will remove "-I"). CMDread
will still remain active until CMD.EXE itself exits.
-z - Disable
Disable CMDread, restoring the original input behaviour.
-_ - Underscore
Underscore is usually treated as part of a word (e.g. "abc_123" forms a
single word). This option treats underscore as punctuation (the prior
example becomes two words).
Finally, a file name can be given to configure CMDread. The default name
is "CMDread.cfg" in %USERPROFILE%. The file can contain anything: lines
beginning with a dash ("-") and blank lines are ignored (unless they are
part of a macro definition); a CMDread internal command will be executed;
anything else will be stored in the history. The format of the commands in
the file is the same as if you typed them from the command prompt, except
there is no need to escape "^". Lines may be up to 2046 characters long.
The file is interpreted using the system OEM code page, unless it starts
with the UTF-8 byte-order mark.
Configuration can be customised according to the initial directory by
starting a line with "#" followed by the directory (using the full path,
without any quotes). If the immediate next line starts with "=", what
follows is the history file; otherwise the normal primary rule applies.
The history file's path will be taken relative to the config file.
Keys
----
CMDread recognises all the normal control keys, shift and control keys,
normal, shift, control, and alt editing and function keys, and normal,
shift, control, and shift and control backspace, tab, enter and escape.
Control is represented by "^", shift by "#", shift and control by "#^" (but
not "^#") and alt by "@". The normal control keys are "^A" to "^Z", plus:
^@ - Ctrl+2 ^[
^^ - Ctrl+6 ^]
^_ - Ctrl+- ^\
The names of the other keys are:
Bksp Backspace Ins Insert
Del Delete Left Arrow left
Down Arrow down PgDn Page down
End End PgUp Page up
Enter Return Right Arrow right
Esc Escape Tab Tab
Home Home Up Arrow up
Function keys are simply "F1" to "F12".
There are also shortcut keys to the Edit menu:
Alt+C Mark
Alt+F Find...
Alt+S Scroll
Alt+V Paste
Alt+keypad entry has been improved, too. A leading zero will make the num-
ber hexadecimal, using "/*-+Enter." as hex digits A to F. A decimal number
between 1 and 255 will be taken as an OEM (code page) character, otherwise
it will be treated as Unicode (up to U+FFFF).
DEFK - Define key
Assign a function, macro or command to a key. Without an assignment it
will remove the current one (same as DELK).
DEFK ^A
DEFK ^A Ignore
will cause CMDread to ignore Ctrl+A.
DEFK ^A =cls
DEFK ^A Erase "cls" Execute
will cause CMDread to replace the current line with "cls" and enter it.
DEFK @Up -cd ..
DEFK @Up Erase "cd .." HiddenEx
will use Alt+Up to move to the parent directory, staying on the same line.
DELK - Delete key(s)
Remove the assignments (assign to Ignore) of the specified keys.
LSTK - List key(s)
List the assignments of every key, or just those specified. When listing
every key, all the normal keys will be displayed, but the modified keys
will not display the ignored ones.
Functions
---------
The editing functions (in alphabetical order) with their default keys and a
brief description:
Function Key(s) Description
--------------------------------------------------------------------------
AutoRecall ^Y toggle auto-recall
BegLine ^A Home move cursor to the beginning of the line
CharLeft ^B Left move cursor one character to the left
CharRight ^F Right move cursor one character to the right
CmdSep ^S ^] command separator
CopyFromPrev F3 copy remainder of line from previous command
Cut ^C #Del cut selected text or current/previous argument
Cycle ^I Tab file name completion cycle
CycleBack #^I #Tab file name completion cycle backwards
CycleDir ^\ directory completion cycle
CycleDirBack #^\ directory completion cycle backwards
Default just add the character to the line
DelArg #^Bksp delete argument at or left of cursor
DelBegLine ^X ^Home delete to the beginning of the line
DelEndExec ^O delete to the end of the line and execute
DelEndLine ^K ^End delete to the end of the line
DelLeft ^H Bksp delete character to the left of the cursor
DelRight ^D Del delete character under the cursor
DelWordLeft ^L ^Bksp delete word at left of cursor
DelWordRight ^W ^Del delete word at right of cursor
EndLine ^E End move cursor to the end of the line
EndWordLeft #Left move cursor to the end of the previous word
EndWordRight #Right move cursor to the end of the current/next word
Enter Enter accept line
Erase ^[ Esc erase line (and reset history pointer)
Execute ^Enter accept line without adding it to the history
FindBack #^R ^Up incrementally search the history backwards
FindForw #^V ^Down incrementally search the history forwards
FirstLine PgUp recall first command in history
Hidden #^Enter accept line, remove it & prompt from the screen
HiddenEx #^^ as above, without adding it to the history
Ignore totally ignore the key
InsOvr Ins insert/overwrite toggle
LastLine PgDn recall last command in history
List #^F ^Tab file name completion list
ListDir #^D #^Tab directory completion list
MacroToggle ^_ macro/symbol/brace toggling
NextLine ^N Down recall next command in history buffer
Paste #^P #Ins paste cut text
PrevLine ^P ^U Up recall previous command in history buffer
Quote ^Q next key will not be interpreted as a function
Record F12 record a series of keys
Redo #^Z undo the undo
Revert #^U undo/redo everything
SearchBack ^R F8 search the history backwards
SearchForw ^V #F8 search the history forwards
Select ^M select text
SelectFiles #^S select files from the standard Open dialog
StoreErase ^G erase the line but put it in the history
StringLeft @Left move cursor to start of current/previous string
StringRight @Right move cursor to start of next string
SwapArgs #^A swap current/previous argument with that before
SwapWords #^T swap current/previous word with that before
Transpose ^T swap character at the cursor with that before
UnderToggle #^_ change behaviour of underscore
Undo ^Z undo changes to the line
UpdateEnter #Enter accept line, updating the history
UpdateErase #^G erase the line but update the history
VarSubst ^J inline substitution/brace expansion/association
Wipe ^^ accept line but remove it from the screen
WordLeft ^Left move cursor to start of current/previous word
WordRight ^Right move cursor to start of next word
A word is a sequence of alphanumeric characters, optionally including the
underscore. A string is a sequence of characters between spaces or tabs.
An argument is a string which may also contain characters between double
quotes. The brief descriptions above should suffice for most functions, so
I will only detail a select few.
CmdSep - command separator
CMDread is capable of specifying several commands on the one line. This
key will add the character to separate those commands. Note that this
character is a literal character 19, so commands can also be separated by
quoting ^S or using the keypad. Note that spaces are significant between
the separator: "a b" represents the two commands "a " and " b". This is
particularly important when the ignore character is a space. The command
separator cannot be used with symbol or macro definitions.
CopyFromPrev - copy from previous command
Replace the line from the cursor with the previous command (that was
entered, not from the history), also from the cursor.
FindBack, FindForw - incremental search
Searches the history for any line that contains the text you type in (or
have already entered). Repeating the search will look for another line,
not for another instance of the text on the same line. For example, if you
have a line "CMDread.cmd" and search backwards for "cmd", it will place you
at the "r" after the first "CMD"; searching again will not place you at the
end of the second "cmd", but look for another line.
InsOvr - insert/overwrite toggle
Toggle between insert and overwrite modes for this line; once entered the
default mode will be restored for the next line.
MacroToggle - macro/symbol/brace toggling
Disable (or enable, if "-t" has been used) the usual translations CMDread
makes to the line, explained below.
Quote - the next key will not be interpreted as a function
Disable CMDread's function interpretation of the key and treat it as a
literal character.
Record - record a series of keys
Prompt for a key and remember all following keystrokes, up until Record is
pressed again or the line is entered. Pressing the assigned key will then
play back all those keystrokes again. The assigned key cannot be any key
assigned to Enter, Erase or Record.
Revert - undo/redo everything
If the previous function was Undo or Revert, Revert will Redo everything,
otherwise it will Undo everything.
Select - select text
Using this will mark the current (or last, if at the end) character; use
the normal movement functions to extend the selection. Cut will remember
the selection, then delete it; DelLeft & DelRight will just delete it;
Paste will replace it (provided something has been Cut); anything else will
just remove the mark.
Undo - undo changes to the line
Any function that modifies the line can be undone (and redone, if no fur-
ther changes are made). Repeated uses of a function are all undone at
once, with two exceptions: characters will undo to the start of a word and
file name completion to the prefix. Recalling a line from the history will
reset the undo.
UpdateEnter, UpdateErase - update the history
If a previous line was edited, rather than create a new history entry,
replace the existing one.
VarSubst - inline variable substitution/brace expansion/association
Expand braces and variables, perform association, expand a macro (using the
command separator to combine multiple lines) and expand a symbol, in that
order. Editing then continues on the expanded line. Variables are either
environment variables or symbols, enclosed within percent signs.
File Name Completion
--------------------
CMDread examines the argument to the left of the cursor and tries to com-
plete it as a file name. The argument may contain a full disk and path
specification. If several files match, only the common part of their names
will be placed on the command line, unless the argument already contained a
wildcard. Subsequent action depends on the method of completion chosen:
list or cycle.
In list mode, a list of all possible matching names is displayed. If there
are more names than would fit on the window CMDread asks if they should be
displayed; if there are more names than would fit in the console buffer
CMDread does not display them at all.
In cycle mode, all matches will be displayed in turn. Once all matches
have been displayed the original common part will be displayed, then the
cycle will continue again.
If the name to be completed is the first argument on the line then only
executables and directories will be selected. Executables are defined by
CMDread's and Window's associations and one of the "FEXEC" or "PATHEXT"
environment variables. If neither of those variables is defined the def-
ault list is
set FEXEC=.exe.com.bat.cmd
If it's not the first argument then certain extensions will be ignored.
These can be selected with the "FIGNORE" environment variable. The default
list is:
set FIGNORE=.exe.com.dll.obj.o.bak
If a file with an ignored extension is the only such file then it will be
selected. Files with no extension can be selected by having a dot by it-
self (e.g.: "set FIGNORE=.exe.com.dll.obj.o.bak.").
If the matching name is a directory a "\" or "/" is appended (depending on
what you've entered yourself), making it easier to enter a complete path
specification (unless this has been disabled with the "-b" command line
option, in which case nothing is appended). If the matching name is not a
directory a space is placed after the name.
Brace Expansion
---------------
Brace expansion is usually used as a shorthand method of naming files.
Instead of having to type:
del temp\file1.tmp temp\file2.tmp
you can type:
del temp\file{1,2}.tmp
The list inside the braces must be comma-separated, and it will recognise
spaces:
del temp\file{1, 2}.tmp
will expand to:
del temp\file1.tmp temp\file 2.tmp
which is probably not what you want. Braces work inside quotes, though:
del "temp\file{1, 2}.tmp"
becomes:
del "temp\file1.tmp" "temp\file 2.tmp"
Braces can be nested, and the expansion will also recognise commas, semi-
colons and plus signs as separators and "<|>&" as terminators:
tc file1;temp{2,3},exclude{4,5}>nul
will become:
tc file1;temp2;temp3,exclude4,exclude5>nul
@
-
When used at the start of a line "@" is a special command line modifier
which asks CMDread to "dosify" the line. CMDread will replace "/" with
"\", leading "-"s with "/" and remove trailing backslashes from the line.
For example, if you type:
@rd -q /old/directory/
CMD.EXE will see:
rd /q \old\directory
^
-
As with CMD.EXE, CMDread uses the "^" character as an escape character.
Any character following it will be treated as a literal character, losing
any special significance CMDread would give it. Of particular note is
specifying control keys on the command line, which require two "^" char-
acters to be recognised (e.g.: "lstk ^^a"). However, within strings, back-
slash should be used to escape a quote (`defk ^^p "\"Program Files\""').
History
-------
The history stores each line that has been entered (provided it meets the
minimum length requirements of "-l"). Moving through the history is a
cyclic operation, so if you come to the end it will continue from the
start. Erasing a line will move the history back to the start. A line is
only stored once, matching case. Searching, however, is always done ig-
noring case. A search is successful when all the characters from the beg-
inning of the line up to the cursor are matched.
DELH - Delete history
Lines containing text will be removed from the history. This includes the
DELH line itself.
DELH rem
will remove every line containing "rem" from the history.
LSTH - List history
List every command in the history, the last N commands, the first N com-
mands or every command containing text. The LSTH command itself will only
be included when listing every command. This command treats quotes as lit-
eral characters (although a redirected file name must still be quoted as
usual) and trailing spaces are significant (but a space before ">" or "|"
is removed).
LSTH 5 list the last five lines
LSTH -5 list the first five lines
LSTH text list the lines containing "text"
LSTH ^5 list the lines containing "5"
LSTH " >quotes "quotes" will contain lines having quote-space
RSTH - Reset history
Remove every command in the history.
File Association
----------------
DEFA - Define association
Directories and certain extensions can be "directly" executed from the com-
mand line. If the first argument on the line ends in either a slash or
backslash (i.e. "/" or "\") it will be treated as a directory and have the
definition of the backslash association inserted and the trailing character
removed:
defa \ @cd
utils/
will become:
@cd utils
If the first argument contains an extension the association list will be
searched for that extension and its definition inserted. The list is a
group of extensions (including the dot) followed by the definition.
defa .txt.doc view
CMDread.txt
will become:
view CMDread.txt
Files without an extension can be associated by a single dot:
defa .c.asm. tde
will associate C, assembly and extensionless files to tde. However, remem-
ber to type the dot yourself, as file name completion will not add it.
A secondary association can be made by appending "=" to the extension:
defa .txt=.doc= tde
CMDread.txt=
will become:
tde CMDread.txt
DELA - Delete association(s)
Associations can be removed by using DELA. Supply either a complete list
or individual extensions:
dela .txt.doc
will remove the exact list of ".txt.doc", but
dela .txt .doc
will remove ".txt" and ".doc" from whatever list contains them.
LSTA - List association(s)
List all associations, or just those specified. Each specific extension
will be listed individually, even if it is part of a list.
lsta .txt .doc ==> defa .txt view
defa .doc view
RSTA - Remove associations
Remove every association.
Symbols
-------
DEFS - Define symbol
Symbols (also known as aliases) replace a word at the beginning of the line
with any sequence of characters.
defs dw dir /w
dw/b directory
will become:
dir /w /b directory
Redefining a symbol will replace the previous definition; defining a symbol
the same name as a macro will remove the macro definition.
DELS - Delete symbol(s)
Remove the specified symbols.
LSTS - List symbol(s)
Display all symbols, or just those specified.
RSTS - Reset symbols
Remove every symbol.
Macros
------
DEFM - Define macro
Multi-line command macros are created by issuing the DEFM macro-name
command. Each line is terminated by hitting Enter, and the macro is term-
inated with the ENDM command. Macro command lines may contain parameters,
which are designated by %N (N is a numeral from 0-9); %N* is shorthand for
parameter N and all parameters after it; %* is shorthand for %1*. Macros
will stop processing parameters at one of "<>|&"; if found, the rest of the
line will be appended after the definition of the first line.
defm v unzip -c %* | view
v zipfile file_id.diz readme.txt
v zipfile *.txt |tde
will become:
unzip -c zipfile file_id.diz readme.txt | view
unzip -c zipfile *.txt | view |tde
and:
defm mcd
md %1
cd %1
endm
mcd newdir
mcd dir1 dir2 2>nul
will become:
md newdir
cd newdir
md dir1 2>nul
cd dir1
The name may be left out, in which case the macro will expand on an empty
line.
defm
time/t
endm
will show the time by just pressing Enter.
Redefining a macro will replace the current definition; defining a macro
with the same name as a symbol will delete the symbol.
DELM - Delete macro(s)
Remove the specified macros.
LSTM - List macro(s)
List all macros, or just those specified.
RSTM - Reset macros
Remove every macro.
Known Problems
==============
Redirecting internal commands will use the current code page, but if a
character cannot be converted, it will not be written (rather than becoming
a question mark).
A hidden command that has no output will add a blank line if the previous
line is not blank (assuming that to be its output).
The primary history file will be shared between the 64- and 32-bit
versions (i.e. the first instance of each will both be regarded as primary,
so the one that exits last will overwrite the other).
The configuration file shown in the status is the one used if CMDread is
installed (via "-i"), which is not necessarily the file specified on the
command line.
History
=======
Legend: + added, - bug-fixed, * changed.
v2.12, 10 July, 2013:
* modified option handling (only write to the registry with an explicit -i;
write to a specified history file).
v2.11, 4 July, 2013:
- fixed storing file names;
- prevent crash from an invalid file (but still garbage in, garbage out);
* increase maximum line length to 2046 bytes.
v2.10, 24 June, 2013:
* renamed from CMDkey to CMDread (Microsoft already has a Cmdkey);
- fixed file name completion testing for directory on an empty name;
- fixed exe/dll version conflicts (improved future-proofing);
- fixed redefining a keyboard macro;
- fixed listing a single-character keyboard macro;
- remove extra line(s) when wiping a wrapped command;
- fixed interpretation of the custom history file in the config file;
- test if -I/-U fails and show message (need admin rights);
- maintain position when user scrolls window;
- fixed handling of environment variables;
* expand %CD%;
* improved (un)install;
* copy history from primary instance if there's no parent;
* improved file name completion list;
* tweak stats display (remove initial blank line, add underscore setting);
* use %USERPROFILE% as default config/history path (not same as binary);
+ 64-bit version;
+ Windows 8 support;
+ DBCS double-width character support;
+ use a prefix character to update history;
+ new functions Hidden & HiddenEx to wipe the prompt, as well.
v2.01, 8 December, 2011:
* fully work with ANSICON.
v2.00, 22 July to 8 August, 16 September & 15 November, 2011:
- fixed file name completion with leading/trailing dot;
- ensure input is from the console (prevents "set/p <nul" from crashing);
- ignore input from non-commands (at least "set/p");
- find imports by name (fixes ANSICON issue);
- macros will not take arguments after a pipe, ampersand or redirection;
- fixed substituting an empty macro argument;
- piping internal commands will also use the pipe command's options;
- fixed colouring a redisplayed multi-line prompt at the end of the buffer;
- ignore ^C generated by Ctrl+Break;
- read the options even if not installed (to preserve for the install);
- fixed updating the config file;
- fixed the enabled status;
- fixed the initial install;
* removed NT version;
* treat a hex keypad number < 256 as Unicode;
* use specific options for each prompt colour;
* expand multi-line macros using the command separator;
* add "&" to the delimiter list; use it for internal commands;
* LSTH uses "^" to find numbers and the redirection symbols;
* install as a batch file (CMDread.cmd) to improve load time for "cmd /c";
* -e applies to any search, not just blank;
* improved prompt handling for macros & multiple commands;
* auto-recall can continue after a single failure; DelLeft will not delete;
don't continue after DelRight;
* show the file name and line number of a config file error;
* config file will be read as UTF-8, if the BOM is present;
+ new function Execute to prevent adding the line to history;
+ new functions UpdateEnter & UpdateErase to replace a line in the history;
+ new function CopyFromPrev, similar to the original F3;
+ new functions SwapWords & SwapArgs;
+ new function UnderToggle and option -_ to change underscore behaviour;
+ new functions Select, Cut & Paste, to provide a mini-clipboard;
+ new functions EndWordLeft & EndWordRight, to move past the end of a word;
+ new functions FindBack & FindForw do an incremental search;
+ new functions Undo, Redo & Revert;
+ custom configuration based on initial directory;
+ provide a persistent history;
+ copy the history from the parent instance (if not loading it);
+ added colour for the prompt's base directory;
+ recognise --version.
v1.02, 23 July, 2010:
- handle control characters better;
- fixed alternative directory association in the root;
- LSTK was using the Shift+Control definition for the Control keys;
- fixed completion when an explicit wildcard didn't match anything;
- completion will not match smaller than original (preserve trailing dot);
* add a quote for completion if a character after the prefix needs it;
* improved completion sorting (at least on NTFS);
+ -I (and -U) install to local machine.
v1.01, 20 March, 2007:
- scroll the window to display an entire recalled command;
- remember Enter when recording a macro.
v1.00, 23 December, 2006:
+ first release.
==========================
Jason Hood, 10 July, 2013.