How to? Remove last argument on command line

Feb 23, 2012
240
3
I find myself often repeating the following sequence:
1] I hit up-arrow on the command line to go to a previous command
2] I erase the last argument of that command (usually a filename)
3] I fill in a new filename for the argument (usually by typing a mask and using autocomplete) and hit enter.
The item that I'd like to figure out how to do more efficiently is step #2. How can I remove that last argument with a single keypress?
Right now, after recalling that previous command, I can backspace over the last argument, or I can use shift-left-arrow to select it and then delete it. The problem is that a single shift-left-arrow generally doesn't do the job, because shift-left-arrow doesn't select a whole argument; rather, it stops at underscores, dashes, and periods, and I often find that I have to press shift-left-arrow 4 or 5 times until I select the whole filename.
Hence, I'm wondering: is there a way to erase the entire argument with a single keystroke?
 
May 20, 2008
11,411
99
Syracuse, NY, USA
My fingers have learned Control-L to erase the word to the left of the cursor. Yes, it may be necessary to press it several times, but that never bothered me.
I figured there had to be an erase_word_left, but that one works oddly with quoted strings. For example, if you start with

a "b c"

the first Ctrl-L erases c
, the second erases b[space], and you need another to erase the remaining quote.

I would have thought ... only one (to erase the entire quoted word) or two (erase c
, then
b[space]. The same holds for the single quote and the back-tick.
 
May 20, 2008
11,411
99
Syracuse, NY, USA
My fingers have learned Control-L to erase the word to the left of the cursor. Yes, it may be necessary to press it several times, but that never bothered me.
Well that got all fouled up by my putting "quote" in brackets! I'll try again. If I start with

a "b c"

the first Ctrl-L erases c-quote, the second erases b-space, and the third erases the remaining quote.

Two would be better (erase c-quote, then quote-b-space). Better yet, only one (erase the entire quoted arg).
 
Similar threads
Thread starter Title Forum Replies Date
Dmitry L. Kobyakov How to? How to remove the record of the old version of the Take Command? Support 7
MikeBaas Edit/remove kbd shortcuts of Macro Recorder? Support 7
gworley rd (Remove Directory) gives interesting error: Support 2
x13 TPIPE /REPLACE - Remove line (including EOL) Support 3
C NE1 have BTM to remove %appdata\JP Software\ etc... Support 0
H DOS CMD Sort+Add Sequence+Remove Sequence number Support 12
vefatica Remove double-quotes with TPIPE Support 4
H Remove all previous activations Support 4
D Fixed Cut and paste in TC's file/folder view does not remove file Support 17
vefatica Must update remove my taskbar-pinned shortcut? Support 20
samintz How to? remove adjacent common chars Support 2
C Drag-and-drop from file-view may "remove" Support 1
S Setup - remove older versions? Support 4
C Can't remove leading quote from a string Support 2
A Cannot permanently remove Tabs toolbar using View menu - bug? Support 8
thedave Remove a section from an INI file Support 6
C Last TCMD that supports win 7? Support 5
M No line wraps if last line of the screen buffer is reached Support 5
R "The Specified Account Already Exists" - Can't Reinstall To Fix Protection Screw-Up of Last Week Support 8
P No linefeed on last line of console window Support 2
B How can a user know the last 'true command' executed Support 1
B Fixed FFIND doesn't find last character in file without CR/LF at EOF Support 1
rps Fixed Using last argument variable ! Support 5
B %@lines doesn't count last line without cr/lf at eof Support 1
J WAD First Record, Last Record, Next Record, Previous Record Support 11
greyfairer Very slow startup since last Windows 7 Update (14.03.59 x64) Support 9
fpefpe Last 13 Support 9
dcantor Fixed Ctrl+Shift+Insert repeats last character Support 3
Stefano Piccardi did the forum software change in the last two days? Support 2
R TC11 - copy last cmd to bottom of history Support 4
rconn Last call for v12 feature requests Support 59
nikbackm Trim last N lines from a file Support 6
D Keystroke to copy previous argument Support 3
C Replace 1st argument on command line Support 4
D Can the argument to RETURN be a function expansion? Support 3
Fross TabComplete Argument Issue Support 1
jbanaszczyk @Full and unquoted argument Support 4
Jay Sage TCMD 14 Ignores Argument Support 6
D Help says @fileage accepts u argument Support 3
M Just an argument-passing "strangeness" that I didn't expect... Support 19
M A probably stupid question about .btm file argument parsing... Support 6

Similar threads