Windows批处理文件的文件大小和行长限制 [英] File-size and line-length limits for Windows batch files

查看:161
本文介绍了Windows批处理文件的文件大小和行长限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在生成一个Windows批处理文件,该文件可能会变得很大,例如几兆字节.我已经搜索了有关批处理文件中最大文件大小和一行的最大长度的可能限制,但找不到任何东西.有实际经验吗?

I am generating a Windows batch file that might become quite large, say a few megabytes. I've searched for possible limits regarding the maximum file size and maximum length of a line in a batch file, but I couldn't find anything. Any practical experiences?

推荐答案

我认为文件大小可以达到2 GB,甚至可以更大.这是一种解释型语言,因此如果正确执行此操作,则文件大小限制应为文件系统的文件大小限制.我从来没有任何批处理文件太大的错误,而我创建的一些文件大小只有几MB.

I think filesize can be anything up to 2 GB, perhaps even more. It's an interpreted language, so if this is done right, filesize limit should be the filesize limit of the file system. I never had any errors with batch files being too large, and some of those I created were several MBs in size.

应该有一个行长限制,但是它应该大于256.可以很容易地进行测试,只需在"echo%A%"之后执行一些设置A = 123456789012 ... endofline",然后'看看你能走多远.

There should be a line length limit, but it should be more than 256. This can easily be tested, just do some "set A=123456789012...endofline", after that "echo %A%", and you'll see how far you can go.

它对我来说行很长(4K左右),但是在8K时echo会提示行太长",因此8192字节应该是一个限制.

It works for me with very long lines (around 4K), but at 8K echo gives a message, "Line too long", so 8192 bytes should be some limit.

现在也对文件大小进行了测试,在"echo end"之后测试了"echo off",数千行设置,并处理了11 MB的文件(尽管花了几秒钟才完成:)-无限制在这里可见.

Now tested for filesize, too, tested with "echo off", thousands of set lines, after that "echo end", and it worked for a 11 MB file (although it took some seconds to finish :) - no limit in sight here.

110 MB也起作用.这够了吗? ;)

110 MB worked, too. Is this enough? ;)

这篇关于Windows批处理文件的文件大小和行长限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆