Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Why the prompt to del c:\*

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]
 
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 ?
 
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.
"*"
 
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.
 
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).
 
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

Back
Top