Computing.Net > Forums > Programming > Why doesn't redirect work?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Why doesn't redirect work?

Reply to Message Icon

Name: Renaissance Man
Date: October 3, 2009 at 20:46:35 Pacific
OS: Windows XP Pro
CPU/Ram: Core 2 / 2MB
Product: Dell / ?
Subcategory: Batch
Comment:

I was pretty good in DOS, but I'm lost in XP.

This works fine:
@ echo Press the Y key and then press Enter
@del "C:\Documents and Settings\All Users\Application Data\avg8\Log\*.*">nul

This does not:
@del "C:\Documents and Settings\All Users\Application Data\avg8\Log\*.*"<c:\y.txt
Where Y.txt contains Y

The Y is redirected to the del command, but files are not deleted.

Why?



Sponsored Link
Ads by Google

Response Number 1
Name: Wahine
Date: October 4, 2009 at 00:16:12 Pacific
Reply:

Try

@echo y | del "C:\Documents and Settings\All Users\Application Data\avg8\Log\*.*"


0

Response Number 2
Name: Renaissance Man
Date: October 4, 2009 at 02:13:52 Pacific
Reply:

Thanks a lot; it worked.

I haven't done this in so long I've forgotten the basics.


0

Response Number 3
Name: Mechanix2Go
Date: October 4, 2009 at 05:57:30 Pacific
Reply:

RM,

You're quite right that XP is different from DOS in many important ways.

For both DOS & XP [NT5x], some commands will take a pipe or redirect and some won't.

In the case of DEL, NT has a built-in switch:

/Q Quiet mode, do not ask if ok to delete on global wildcard

[del /?]


=====================================
Helping others achieve escape felicity

M2


0

Response Number 4
Name: tvc
Date: October 23, 2009 at 09:28:23 Pacific
Reply:

Yeah, reverse redirection does not always work, even on standard commands. Do check that you input command contains an enter (after the text you want to give it), this may be a reason why it fails as well.


0

Response Number 5
Name: Razor2.3
Date: October 23, 2009 at 14:47:28 Pacific
Reply:

Back to the original question,
The Y is redirected to the del command, but files are not deleted.

Why?
Presumably, your 'y.txt' has just a "Y", and no trailing Enter.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon





Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Why doesn't redirect work?

WHY DOESN'T THIS WORK???? www.computing.net/answers/programming/why-doesnt-this-work/1933.html

Why doesn't this work: Visual C++ www.computing.net/answers/programming/why-doesnt-this-work-visual-c/2665.html

Mouse doesn't show up in Turbo C 2.01 www.computing.net/answers/programming/mouse-doesnt-show-up-in-turbo-c-201/1914.html