批量输出文件是否有大小限制?

时间:2015-08-31 18:25:04

标签: batch-file output filesize

我写了一个非常简单的批处理文件,用于将输出定向到文件。这是文本正文:

DATE /T > FileTreeList.txt
TIME /T >> FileTreeList.txt
cd >> FileTreeList.txt
tree /f /a >> FileTreeList.txt

当我在具有大量文件夹和文件的目录中运行批处理文件时,输出文件(FileTreeList.txt)会截断大约621KB。如果我从命令模式运行批处理文件并将输出直接输出到文件,我得到相同的结果。但是,如果我让结果显示在屏幕上,它会显示所有结果。

为什么会发生以及如何解决?

2 个答案:

答案 0 :(得分:1)

可能你的硬盘已满,只有大约621KB的可用空间;)

答案 1 :(得分:0)

我猜这是当前文件夹的树。 如果你想要一个更大的文件,请尝试转到%HOMEDRIVE%并列出驱动器中的所有文件夹/文件。试试这段代码:

@rem Turn the command line (C:>COMMAND before every command)
@echo off
rem Go to the homedrive (if not currently in)
if "%cd:~0,1%"=="%homedrive:~0,1%" call %homedrive:~0,1%:
rem go to the root of homedrive
cd %HOMEDRIVE%
rem execute your code
DATE /T > FileTreeList.txt
TIME /T >> FileTreeList.txt
cd >> FileTreeList.txt
tree /f /a >> FileTreeList.txt
相关问题