我无法在批处理文件中自动回答是

时间:2013-02-14 03:04:24

标签: batch-file command-line windows-7

我在 Windows7 中创建了这样的批处理文件,但它无法删除文件。

echo y | DEL autorun.inf
echo y | DEL autorun.ini

当我运行此代码时,它显示如下但不删除任何文件。

  

N:> echo y | DEL autorun.inf N:\ autorun.inf *,你确定(是/否)? ÿ

     

N:> echo y | DEL autorun.ini N:\ autorun.ini *,你确定(是/否)? ÿ

似乎输入是<但是不输入

如何在批处理文件中自动回答“是”。

3 个答案:

答案 0 :(得分:2)

使用/f标志强制删除只读文件,/q标志用于安静模式(无删除确认)

echo DEL /f /q autorun.inf
echo DEL /f /q autorun.ini

答案 1 :(得分:0)

echo y | DEL autorun.inf /Q

/ Q不会要求确认

答案 2 :(得分:0)

echo Y | del "C:\Packages_Auto_Download\EIR\17\IB01" /Q

上面的命令可以正常删除没有任何问题。

相关问题