中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-18 23:04
47,814 topics / 349,908 posts / today 1 new / 48,259 members
DOS疑难解答 & 问题讨论 (解答室) » How to make the default input for xcopy c:\txt d:\txt /d /u /p be N
Printable Version  980 / 4
Floor1 windbamboo Posted 2007-03-21 00:51
新手上路 Posts 3 Credits 8
I tried echo N|xcopy c:\txt d:\txt /d /u /p

But the result shown was as follows:

C:\Documents and Settings\Dell>echo N|xcopy c:\txt d:\txt /d /u /p
C:\txt\1.txt (Y/N)? N
C:\txt\15204.txt (Y/N)?
C:\txt\15204.txt (Y/N)?

C:\txt\15204.txt (Y/N)?

C:\txt\15204.txt (Y/N)? C:\txt\21195.txt (Y/N)? 0 File(s) copied

Why did it turn out like this?
Floor2 Michael Posted 2007-03-22 02:20
钻石会员 Posts 3,041 Credits 10,056
Because what echo N sends is not just the keyboard scan code for N.
You can solve it with for ......... exist................, or write a binary file whose contents are all 4e, then use < to redirect it to xcopy's input.
Floor3 windbamboo Posted 2007-03-23 00:51
新手上路 Posts 3 Credits 8
Thanks to Michael for the helpful explanation, I basically understand the reason now, and I'm currently thinking of a way to solve it. Thanks again!
Floor4 Wengier Posted 2007-03-23 14:32
系统支持 Posts 10,521 Credits 27,736
You can have a look here. I've already proposed adding an /I switch to the CP command, to automatically answer "No", that is, skip files that already exist:

http://www.cn-dos.net/forum/viewthread.php?tid=28739&fpage=1
Floor5 itieim Posted 2007-04-21 07:10
新手上路 Posts 9 Credits 18
How do I suppress the [y|n] in the sc command?
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023