找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 20646|回复: 2

[文件操作] 修改代码

[复制链接]
发表于 2012-8-27 10:02:46 | 显示全部楼层 |阅读模式
@echo off
echo 请先将*.txt重命名为1.txt并和批处理在同一目录下,文档里的文件名不能在同一行并要有后缀名
set /p lj=请输入要拷贝到的路径(X:\文件夹):
md "%lj%"
for /f "skip=1" %%i in ('^(wmic logicaldisk where drivetype^='3' get name^)') do (echo 正在%%i\中搜索......
  echo %%i|findstr ":">nul&&(
    for %%j in (1.txt) do (
      for /f "delims=" %%a in (%%j) do (
        for /f "delims=" %%b in ('dir /a /b /s "%%i\%%a"') do (
          for /f "tokens=1-3" %%i in ('attrib "%%b"') do (
            echo %%i|findstr /i "\<s\> \<h\> \<sh\>">nul&&(attrib -s -h "%%b"&set abc==)
            echo %%j|findstr /i "\<s\> \<h\> \<sh\>">nul&&(attrib -s -h "%%b"&set abc==)
            echo %%k|findstr /i "\<s\> \<h\> \<sh\>">nul&&(attrib -s -h "%%b"&set abc==)
          )
          if %%j equ 1.txt copy "%%b" "%lj%"
   
          if defined abc (attrib +s +h "%%b"&set abc=)
        )
      )
    )
  )
)
pause


for /f "skip=1" %%i in ('^(wmic logicaldisk where drivetype^='3' get name^)')改为for  %%i in (c d e f g)后用不了,还要修改哪里吗,请指教下,谢谢
发表于 2012-8-27 10:12:47 | 显示全部楼层
你把@echo off删掉,自己看看执行过程就明白了。
 楼主| 发表于 2012-9-14 13:46:06 | 显示全部楼层
回复 1# xt0883


   我是菜鸟看不出来,这是别人的代码,我只是想在原本的基础上改下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-19 12:48 , Processed in 0.024857 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表