Windows命令仅适用于文件大小 [英] Windows command for file size only

查看:60
本文介绍了Windows命令仅适用于文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在Windows命令,该命令将以字节为单位输出指定文件的大小?

Is there a Windows command that will output the size in bytes of a specified file like this?

> filesize test.jpg
65212

我知道 dir 命令会输出此信息,但也会输出其他信息。

I know that the dir command outputs this information, but it outputs other information also.

我可以很容易地编写这样的程序,但是如果可能的话,我宁愿使用本机Windows命令,或者仅使用全新安装的Windows XP中可用的命令。


I could easily write such a program, but I would prefer to use a native Windows command if possible, or only what is available in a fresh install of Windows XP.

推荐答案

如果您位于批处理脚本中,则可以使用参数变量技巧来获取文件大小:

If you are inside a batch script, you can use argument variable tricks to get the filesize:

filesize.bat:

filesize.bat:

@echo off
echo %~z1

这给出的结果类似于您在问题中建议的结果。

This gives results like the ones you suggest in your question.

类型

help call

在命令提示符下获得所有疯狂的变量操作选项。另请参见本文以获取更多信息。

at the command prompt for all of the crazy variable manipulation options. Also see this article for more information.

编辑:
仅在Windows 2000及更高版本中有效

This only works in Windows 2000 and later

这篇关于Windows命令仅适用于文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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