Board logo

标题: [文件操作] robocopy命令怎么跳过根目录的exe呢 [打印本页]

作者: 如你是我    时间: 2024-4-9 12:26     标题: robocopy命令怎么跳过根目录的exe呢

robocopy %sharefile%%department% %DP% /E /XF *.msi *.exe /A-:H >nul

现在命令是这样的
将 %sharefile%%department%文件夹的所有文件复制到%DP% 跳过msi和exe的程序安装包,但是有个小问题
发现%sharefile%%department%下面子目录里面的安装包也给跳过了
有没有办法只跳过%sharefile%%department%根目录的安装包,而不跳过子目录的安装包
其实就是除了根目录的安装包和所有的隐藏文件,其他的全要
作者: holley    时间: 2024-4-9 14:07

robocopy %sharefile%%department% %DP% /E /XF %sharefile%%department%\*.msi %sharefile%%department%\*.exe /A-:H >nul
作者: 如你是我    时间: 2024-4-9 16:18

回复 2# holley


    不行,/XF 后面会提示错误参数,错误: 无效参数 #5:“\\192.168.1.10\Public\Windows\*.msi”

%sharefile%%department% 变量 随便指定的
作者: 77七    时间: 2024-4-9 17:32

不行就多写两行吧
  1. @echo off
  2. for %%a in (msi exe) do attrib +h "%sharefile%%department%\*.%%a"
  3. robocopy "%sharefile%%department%" "%DP%" /e /xa:h
  4. for %%a in (msi exe) do attrib -h "%sharefile%%department%\*.%%a"
  5. pause
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2