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工具) ---------查看设 ...
随机推荐
- dubbo-源码阅读之Filter实现原理
最近完成一个需求,使用阿里Arms需要在log里面加上traceId,但是发现dubbo异常 被ExceptionFilter捕获 并打印 打印不出traceI,然后百度搜索如何重写Filter 参 ...
- mysql的数据导出方法
mysql的数据导出几种方法 从网上找到一些问题是关于如何从MySQL中导出数据,以便用在本地或其它的数据库系统之上:以及 将现有数据导入MySQL数据库中. 数据导出 数据导出主要有以下几种方法 ...
- mysql通过表空间来恢复或者传递数据
mysql的备份工具通常有 mysqldump ,mysqlpump(5.7后新特性)等备份工具,这里我们可以尝试使用表空间进行传递 方式是:拷贝数据文件+拷贝表空间 对应innodb引擎就是 i ...
- MapFields和并行计算(OpenFOAM)
这几天研究了一下OpenFOAM里的MapFields和并行计算,总结一下. Case 1 先进行并行计算 SetFields 初始化流场 decomposePar 把初始化好的流场分块 mpirun ...
- js手机滚屏效果
原文地址:https://github.com/yanhaijing/zepto.fullpage 第一步:基于移动端的浏览体验,在头部添加浏览器渲染的分辨率 <meta name=" ...
- CF 1082E Increasing Frequency(贪心)
传送门 解题思路 贪心.对于一段区间中,可以将这段区间中相同的元素同时变成\(c\),但要付出的代价是区间中等于\(c\)的数的个数,设\(sum[i]\)表示等于\(c\)数字的前缀和,Max[i] ...
- 吉首大学校赛 I 滑稽树上滑稽果 (Lucas + 莫队)
链接:https://ac.nowcoder.com/acm/contest/925/I来源:牛客网 题目描述 n个不同的滑稽果中,每个滑稽果可取可不取,从所有方案数中选取一种,求选取的方案中滑稽果个 ...
- I/O复用select 使用简介
一:五种I/O模型区分: 1.阻塞I/O模型 最流行的I/O模型是阻塞I/O模型,缺省情形下,所有套接口都是阻塞的.我们以数据报套接口为例来讲解此模型(我们使用UDP而不是TCP作为例子的原 ...
- Java-Class-C:com.github.pagehelper.PageHelper
ylbtech-Java-Class-C:com.github.pagehelper.PageHelper 1.返回顶部 2.返回顶部 1.1. import com.github.pagehel ...
- hive调用MapReduce之后遇到kill command之后卡住或者一直开在MapReduce之前
https://blog.csdn.net/weixin_42158422/article/details/88876943