Batch - forfiles 命令详解
forfiles 命令详解
C:\Users\cuixunxu>forfiles /? FORFILES [/P pathname] [/M searchmask] [/S]
[/C command] [/D [+ | -] {MM/dd/yyyy | dd}] Description:
Selects a file (or set of files) and executes a
command on that file. This is helpful for batch jobs. Parameter List:
/P pathname Indicates the path to start searching.
The default folder is the current working
directory (.).表示开始搜索的路径。默认文件夹是当前工作的目录 (.) /M searchmask Searches files according to a searchmask.
The default searchmask is '*' .根据搜索掩码搜索文件。默认搜索掩码是 '*' /S Instructs forfiles to recurse into
subdirectories. Like "DIR /S".指导 forfiles 递归到子目录。像 "DIR /S"。 /C command Indicates the command to execute for each file.
Command strings should be wrapped in double
quotes. 表示为每个文件执行的命令。命令字符串应该用双引号括起来。 The default command is "cmd /c echo @file". 默认的command是“cmd /c echo @file” The following variables can be used in the
command string:
@file - returns the name of the file.返回文件名
@fname - returns the file name without
extension.返回不带扩展名的文件名
@ext - returns only the extension of the
file.只返回文件的扩展
@path - returns the full path of the file.返回文件的完整路径
@relpath - returns the relative path of the
file.返回文件的相对路径
@isdir - returns "TRUE" if a file type is 如果文件类型是目录,返回true
a directory, and "FALSE" for files.如果是文件,返回false
@fsize - returns the size of the file in
bytes.以字节为单位返回文件大小
@fdate - returns the last modified date of the
file.返回文件上一次修改的日期
@ftime - returns the last modified time of the
file.返回文件上一次修改的时间 To include special characters in the command
line, use the hexadecimal code for the character
in 0xHH format (ex. 0x09 for tab). Internal
CMD.exe commands should be preceded with
"cmd /c". /D date Selects files with a last modified date greater
than or equal to (+), or less than or equal to
(-), the specified date using the
"MM/dd/yyyy" format; or selects files with a
last modified date greater than or equal to (+)
the current date plus "dd" days, or less than or
equal to (-) the current date minus "dd" days. A
valid "dd" number of days can be any number in
the range of 0 - 32768.
"+" is taken as default sign if not specified. 指定日期,有绝对日期和相对日期, 此处-7指当前日期 的7天前 /? Displays this help message.显示此帮助消息 Examples:
FORFILES /?
FORFILES
FORFILES /P C:\WINDOWS /S /M DNS*.*
FORFILES /S /M *.txt /C "cmd /c type @file | more"
FORFILES /P C:\ /S /M *.bat
FORFILES /D -30 /M *.exe
/C "cmd /c echo @path 0x09 was changed 30 days ago"
FORFILES /D 01/01/2001
/C "cmd /c echo @fname is new since Jan 1st 2001"
FORFILES /D +9/27/2019 /C "cmd /c echo @fname is new today"
FORFILES /M *.exe /D +1
FORFILES /S /M *.doc /C "cmd /c echo @fsize"
FORFILES /M *.txt /C "cmd /c if @isdir==FALSE notepad.exe @file"
注意:
这些命令是等价的: /S 等同于 -s, /M 等同于 -m
Batch - forfiles 命令详解的更多相关文章
- forfiles命令详解
目录复制命令: xcopy //server/bak/*.* d:/serverbak /s /e /v /c / d /y /h at 05:30 shutdown ...
- Spring Batch(4): Job详解
Spring Batch(4): Job详解 2016-03-26 18:46 870人阅读 评论(1) 收藏 举报 分类: Spring(6) 版权声明:本文为博主原创文章,未经博主允许不得转载 ...
- Dockerfile 命令详解及最佳实践
Dockerfile 命令详解 FROM 指定基础镜像(必选) 所谓定制镜像,那一定是以一个镜像为基础,在其上进行定制.就像我们之前运行了一个 nginx 镜像的容器,再进行修改一样,基础镜像是必须指 ...
- Git初探--笔记整理和Git命令详解
几个重要的概念 首先先明确几个概念: WorkPlace : 工作区 Index: 暂存区 Repository: 本地仓库/版本库 Remote: 远程仓库 当在Remote(如Github)上面c ...
- linux yum命令详解
yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器.基於RPM包管理,能够从指定的服务器自动下载RP ...
- Linux下ps命令详解 Linux下ps命令的详细使用方法
http://www.jb51.net/LINUXjishu/56578.html Linux下的ps命令比较常用 Linux下ps命令详解Linux上进程有5种状态:1. 运行(正在运行或在运行队列 ...
- Docker命令详解
Docker命令详解 最近学习Docker,将docker所有命令实验了一番,特整理如下: # docker --help Usage: docker [OPTIONS] COMMAND [arg ...
- linux awk命令详解
linux awk命令详解 简介 awk是一个强大的文本分析工具,相对于grep的查找,sed的编辑,awk在其对数据分析并生成报告时,显得尤为强大.简单来说awk就是把文件逐行的读入,以空格为默认分 ...
- android adb 命令详解
ADB (Android Debug Bridge) 是android SDK中的工具,需要先配置环境变量才能使用.起调试桥的作用,可以管理安卓设备.(也叫debug工具) ---------查看设 ...
随机推荐
- JS对象 window对象 屏幕可用高和宽度 1. screen.availWidth 属性返回访问者屏幕的宽度,以像素计,减去界面特性,比如任务栏。 2. screen.availHeight 属
屏幕可用高和宽度 1. screen.availWidth 属性返回访问者屏幕的宽度,以像素计,减去界面特性,比如任务栏. 2. screen.availHeight 属性返回访问者屏幕的高度,以像素 ...
- 统计List中相同的元素
public static <E> List<E> getCommonsElements(List<E> list) { return list.stream() ...
- MOS管知识大集
MOS管 增强型:就是UGS=0V时漏源极之间没有导电沟道,只有当UGS>开启电压(N沟道)或UGS<开启电压(P沟道)才可能出现导电沟道.耗尽型:就是UGS=0V时,漏源极之间存在导电沟 ...
- python字典拼接方法
python的dict拼接有多种方法,其中一种很好用而且速度非常快: x = {**a, **b} 效果等价于: x = a.copy() x.update(b) 注意update()是没有返回值的 ...
- Python3:_pickle使用方法
常遇到的问题: python3使用pickle读取文件提示TypeError或者UnicodeDecodeError的解决办法 “ModuleNotFoundError: No module name ...
- 2017-2018 ACM-ICPC, Asia Tsukuba Regional Contest E:Black or White
这道题可以比较容易看出是线性DP.设dp[i]代表把前i个格子刷成目标状态的最小步数. 写出状态转移方程 dp[i]=min( dp[j]+calc(j+1,i) ) (i-j<=k) calc ...
- Comet OJ - contest #3 C DP
题意:给你一个长度为n序列,和一个数m,问这个序列有多少个子序列,满足这个子序列的所有子序列的和是m的倍数?答案对1e9 + 7取模,n, m范围到5e3; 思路:容易发现,如果一个子序列的长度是n, ...
- 【Java学习笔记】Java的垃圾回收机制
搬以前写的博客[2014-12-30 15:07] 以前很少关注内存的问题,基本没有关注,这方面的小白,原因在于自己都是写的自我娱乐的小程序,不关注性能,不是提供服务.而企业级别的应用在程序稳健性方面 ...
- spring security学习总结
这几天一直在学习spring security的相关知识.逛各大论坛,看相关api与教学视频,获益良多! 简介 Spring Security是为基于Spring的企业应用系统提供声明式的安全访问控制 ...
- Hive学内置条件和字符串函数
https://blog.csdn.net/skywalker_only/article/details/38752003 条件函数 下表为Hive支持的一些条件函数. 返回类型 函数名 描述 T i ...