[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] 谁帮下忙写1个3种情况判断的批处理啊,写一晚没搞定,郁闷。

谁帮下忙写1个3种情况判断的批处理啊,写一晚没搞定,郁闷。
具体想实现的功能是检查C:\Program Files\Thunder Network\NetBarThunder.exe文件
1.如果大于100K以上就运行这个程序
2.如果小于100K以下就退出什么也不干
3.如果这个文件不存在就退出什么也不干

如果不会使用if命令,请参考:
http://bbs.bathome.net/thread-2530-1-1.html

如果不会获取文件大小,请查看for命令的帮助:
In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:

    %~I         - expands %I removing any surrounding quotes (")
    %~fI        - expands %I to a fully qualified path name
    %~dI        - expands %I to a drive letter only
    %~pI        - expands %I to a path only
    %~nI        - expands %I to a file name only
    %~xI        - expands %I to a file extension only
    %~sI        - expanded path contains short names only
    %~aI        - expands %I to file attributes of file
    %~tI        - expands %I to date/time of file
    %~zI        - expands %I to size of file
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

用if exist和for in...哈哈~

TOP

if exist判断是否存在我会`已经可以``
for命令我看了一头雾水`````
搞到我晚上4点
斑竹能否帮我写1个`````

TOP

呃...小狐狸??哈哈~~不是说了吗?%%~zl是那个什么扩展到文件大小

TOP

for /r "C:\Program Files\Thunder Network\" %%i in (*NetBarThunder.exe) do (
if %%~zi gtr 102400 "C:\Program Files\Thunder Network\NetBarThunder.exe"
)
搞定`发上来分享~~~谢谢村庄大牛~~

TOP

返回列表