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

SignUp Now!

Are you sure prompt from DEL command

If I issue a DEL /S command then I get prompted to confirm the action, something like:
G:\Daily_backups_test>del /s 2012-03-31\
G:\Daily_backups_test\2012-03-31\* : Are you sure (Y/N)?
but if I redirect the standard output from the command (say to a file) then:
G:\Daily_backups_test>del /s 2012-03-31\ >>test_del.log
Are you sure (Y/N)?
as you can see, the part of the prompt after the colon still comes out on the console but the rest of it does not and instead appears in the redirected output, making it quite difficult to work out what is going on in certain contexts (in my case, a batch routine that is iterating over subdirectories based on their last update date). Is the split destination of the two elements deliberate?? May I request that it be changed so that both elements are written to the console when standard output is redirected??
FWIW this nit still exists in v14.03.59 and since this post never received a response I am wondering whether or not it passed beneath the radar
This is a feature -- if output is redirected, the prompt is written directly to the console. (Otherwise, you'd be sitting there looking at a blank line and not knowing why TCC stopped working.) And if the filenames were displayed to the console, you couldn't redirect them.

If you want to both see the filenames and redirect them, and also get a visible prompt, use TEE.
This is a feature -- if output is redirected, the prompt is written directly to the console
Okay, I understand the logic of what you're doing but I still think that an 'are you sure' prompt on its own is confusing. Would it not be possible to write the filename to both the redirected location and the console in this particular instance??
Not really, because the output is coming from radically different places. It would require a (substantial) rewrite of DEL. And then people would want it everywhere else that you could be mistakenly using the prompt switch while redirecting (COPY, MOVE, REN, etc.), so I'd have to rewrite all of those commands too.

Similar threads