Zip*_*pon 4 stdin window batch-file
在shell中我可以这样做:
if test -t 0  ; then
  echo stdin is a tty
  exit 0
fi
我怎么能批量做到这一点?
编辑 - 感谢所有测试人员.
@echo off
    timeout 1 2>nul >nul
    if errorlevel 1 (
        echo input redirected
    ) else (
        echo input is console
    )
timeout命令尝试直接访问控制台,如果执行批处理文件,则会失败
myBatchFile.cmd < input.txt
echo something | myBatchFile.cmd
在Windows XP上测试(从W2003 Resource Kit超时),7和8.1.