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

不用for,用for还是%%~ai好点

  1. @echo off
  2. attrib a.txt | findstr /r "\<SH\>" && set vsh=sh
  3. attrib a.txt | findstr /r "\S\>" && set vs=s
  4. attrib a.txt | findstr /r "\H\>" && set vh=h
  5. if defined vs (attrib +s +h a.txt) else (
  6. if defined vh (attrib +s +h a.txt) else (
  7. if defined vsh (attrib -s -h a.txt) else attrib +s +h a.txt))
复制代码
好像简单变复杂了

[ 本帖最后由 风行者 于 2009-7-13 12:21 编辑 ]
1

评分人数

    • wxcute: 运用了FINDSTR查找属性,但缺陷比较严重。 ...PB + 2

TOP

返回列表