Why the prompt to del c:\*

Jun 4, 2008
30
0
Consider the following two examples (phase1 is a directory under our current directory):

[C:\TestPad\financial\data]del phase1\*
C:\TestPad\financial\data\phase1\* : Are you sure (Y/N)? Y
TCC: (Sys) There are no more files.
"C:\TestPad\financial\data\phase1\*"
0 files deleted

[C:\TestPad\financial\data]del phase1/*
C:\TestPad\financial\data\phase1\* : Are you sure (Y/N)? Y
TCC: (Sys) There are no more files.
"C:\TestPad\financial\data\phase1\*"
C:\* : Are you sure (Y/N)? N <<<<<<<<<<<<<<<<????
0 files deleted

Okay I made a mistake in the second case by using /* instead of \* - I have been working writing Perl code and it was a slip. Still it did try to clear out phase1 (there were no file in the directory) but why did it come back with a prompt to clear the root of C:?

Of course I first hit this when I failed to read my prompt carefully and did delete files from the root of C:\. Fortunately nothing disastrous was delete :)

Note to self: Read the prompts!!!

David

Oh yes: TCC 14.03.59 x64 Windows 7 [Version 6.1.7601]
 
Nov 13, 2008
255
3
www.thedave.me
The "/" is seen as a switch character (ending the parsing of the first file name), so the command line is interpreted as:

del phase1 /*

(You can thank CMD and the users who refuse to put spaces before their switches for this one.)

That's fair. Why does /* get interpreted as C:\* but /q not interpreted as C:\q ?
 
May 20, 2008
11,400
99
Syracuse, NY, USA
Because /Q is a valid switch character, so it gets removed. /* isn't, so it gets passed on to Windows as a filename.
Wouldn't an invalid parameter message be more appropriate, as with DIR?
Code:
v:\> dir c:\ /*
TCC: (Sys) The parameter is incorrect.
"*"
 
May 20, 2008
11,400
99
Syracuse, NY, USA
Wouldn't an invalid parameter message be more appropriate, as with DIR?
Code:
v:\> dir c:\ /*
TCC: (Sys) The parameter is incorrect.
"*"
P.S. I do not use UNIX style paths. If "/*" is not a valid switch it should never be treated as a (rather dangerous) set of files. Like DEL, COPY and MOVE also treat it as a set of files.
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
Wouldn't an invalid parameter message be more appropriate, as with DIR?

No. DIR has a custom parser (again for CMD compatibility). Most other commands use the generic parser.

You are never going to win this argument; TCC / 4NT / 4DOS have behaved this way for more than 20 years -- as have CMD and COMMAND. Changing this would break untold millions of batch files and aliases; it isn't going to happen.

If you want to complain about the treatment of '/', take it up with Microsoft (who defined it both as a switch character and a path separator).
 
May 20, 2008
11,400
99
Syracuse, NY, USA
I don't suppose appealing to CMD compatibility would work either.
Code:
F:\> ver
 
Microsoft Windows [Version 6.1.7601]
 
F:\> del abc /*
Invalid switch - "*".
 
F:\> copy /* v:\avtemp.btm f:\
The syntax of the command is incorrect.

CMD's MOVE does treat "/*" as a file spec. Frankly, that's dumb and should not be emulated. As for the "next product" I'd like a TCC which didn't do dumb things for the sake of CMD compatibility, and which is simply better. You're free to break my batch files; as long as the functionality remains, I'll re-write them.
 
Similar threads
Thread starter Title Forum Replies Date
Steve Pitts Are you sure prompt from DEL command Support 5
vefatica ANSI, PROMPT ... ??? Support 1
FreezerBurnt ANSI Prompt messes up list output. Support 39
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
M How to? Black TCC Prompt Support 2
N Command execution slows down in TCC Prompt after a while Support 6
K Fixed Prompt display will be shifted after use dir to display a filename with Chinese. (v25.00.28 x64) Support 18
vefatica Timing commands with $= in the prompt? Support 16
samintz How to? Alias or prompt? Support 1
T Elapsed time format in prompt changed in TCC 25 Support 10
samintz MOVE and Prompt on overwrite Support 3
robinsiebler Creating a custom prompt Support 9
K TCC prompt background color Support 4
Alpengreis Problem if command prompt is not legacy Support 4
Joe Caverly Documentation Customizing the TCC Prompt Support 0
C How to? handle the UAC prompt on computer restarts with Everything Support 3
B when doing SFTP via IFTP to my secure site my users always get the finger print key prompt Support 1
M PROMPT with git branch Support 1
MikeBaas How to? SELECT: exclude files / display prompt Support 2
vefatica ? "prompt" command Support 3
S Elapsed time in TCC prompt question Support 0
Joe Caverly Determine if program started from command prompt Support 2
W Opening a new tab takes forever to get the command prompt Support 5
vefatica UAC prompt? Support 0
C How to? ctrl-c does not prompt "Terminate batch job" Support 2
Mordachai TCMD Prompt Here?!@ Support 14
vefatica Fixed DO, OSD, and cancel batch prompt Support 3
CWBillow Send Command-line with prompt? Support 6
S WAD BDEBUGGER command changes window title to "TCC Prompt" Support 4
S WAD Invoking BDEBUGGER changes window title to "TCC Prompt" Support 7
vefatica Cancel batch prompt? Support 0
1 CMD file kicks out to prompt Support 18
Exolon Strange Prompt. Support 6
JohnQSmith TC 13 - Prompt Support 2
S TITLEPROMPT - width x height in prompt? Support 14
T Wrong prompt in Windows command console Support 3
S 4NT - delete from command prompt and recycle bin Support 12
vefatica @@key aliases cause new prompt? Support 16
H Another multiple FTP password prompt issue Support 2
H Double prompt for password with * in FTP syntax Support 3
CWBillow TCMD prompt here only opens to root Support 6
D setting days back at prompt Support 12
M TCC Prompt Here Colors Support 0
Phileosophos Using a percent sign in the PROMPT Support 3
Charles Dye INPUT prompt oddity Support 5
R Start Prompt Here? Support 9
Ville Changing folders location from TCC prompt? Support 7
E Shorter prompt / ANSI codes support Support 10
Joe Caverly MKLINK and Streams and DEL Support 4
S CMDebug 22 issue with del command Support 1

Similar threads