惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
S
Securelist
小众软件
小众软件
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 司徒正美
博客园 - Franky
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
O
OpenAI News
Cloudbric
Cloudbric
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
MongoDB | Blog
MongoDB | Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
V2EX
PCI Perspectives
PCI Perspectives
T
Troy Hunt's Blog
Schneier on Security
Schneier on Security
P
Palo Alto Networks Blog
M
MIT News - Artificial intelligence
V2EX - 技术
V2EX - 技术
阮一峰的网络日志
阮一峰的网络日志
Hacker News - Newest:
Hacker News - Newest: "LLM"
G
Google Developers Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The Last Watchdog
The Last Watchdog
The Register - Security
The Register - Security
腾讯CDC
N
News and Events Feed by Topic
C
Check Point Blog
爱范儿
爱范儿
T
Tailwind CSS Blog
Webroot Blog
Webroot Blog
P
Proofpoint News Feed
S
Schneier on Security
MyScale Blog
MyScale Blog
N
News | PayPal Newsroom
Recorded Future
Recorded Future
T
Tenable Blog
I
InfoQ
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Microsoft Security Blog
Microsoft Security Blog
Simon Willison's Weblog
Simon Willison's Weblog
Engineering at Meta
Engineering at Meta

博客园 - 荣-

学习实践:使用模式,原则实现一个C++自动化测试程序 学习实践:使用模式,原则实现一个C++数据库访问类 C++字符转换等常用方法 DLL内存管理模板类 字符串处理代码(国际化转换C++版) 我的C++数据库访问库--临界区处理类 我的C++数据库访问库 C++中,以类成员函数指针作为参数对std::map中的元素进行迭代处理 取得MySQL数据库表,列信息的SQL语句 我的我的C#数据库操作类(与大家交流) ACE项目的重构整理 安装SQL Server 2000和sp补丁时,安装程序提示"以前的某个程序安装已在安装计算机上创建挂起的文件操作。运行安装程序之前必须重新启动计算机"。 我的计算机安装步骤 创建oracle用户 我的重构步骤 我的C++代码检查列表 PowerDesigner高级应用 文档的阅读 如何设计类
批处理文件的学习
荣- · 2011-08-26 · via 博客园 - 荣-

最近在学习写批处理文件,感觉批处理文件语法和其他语言语法相差不是一般的大。

我把最近写的一个自动添加昨日修改文件日志的批处理程序放在这儿:

set path=F:\xumingxsh\

set upath=F:\xumingxshother\

set index=0

 @echo off&setlocal enabledelayedexpansion
 set yyyy=%date:~0,4%
 set mm=%date:~5,2%
 set dd=%date:~8,2%
 set /a od=!dd!-1
 if !od!==0 call :dd0
 if !mm!==0 call :mm0
 
 set  kk=!yyyy!-!mm!-!od!
 set fd=F:\xumingxsh\ivsmlog\!kk!.txt
 if exist !fd! (
  rem echo 完成昨日工作备份
  rem goto :eof
  del !fd!
 )
 DIR /A:D /B >>F:\xumingxsh\ivsmlog\!kk!.txt

 echo 查找文件夹%path%中!kk:~0,10!修改的文件:>>!fd!
 echo 查找文件夹%path%中!kk:~0,10!
 
 call :ForeachDirf %path% !fd! !kk:~0,10!
 
 echo  "\r\n"  
 echo  "\r\n"   
 
 
 echo 查找文件夹%upath%中!kk:~0,10!修改的文件:>>!fd!
 echo 查找文件夹%upath%中!kk:~0,10!修改的文件:
 call :ForeachDirf %upath% !fd! !kk:~0,10!
 echo !fd!
 
 if not exist !fd! (
  echo 文件不存在
  )
 start notepad !fd! 
 pause


:ForeachDirf:
 for /D %%a in (%1\*) do (
  if not "%%a" equ ".svn" (
  
  set dt1=%%~ta&set t1=!dt1:~0,10!
   if "!t1!" equ "%3" (
     echo %%a
     echo %%a !dt1!>>%2
   )
   
   for  %%s in (%%a\*.*) do (
    set dt=%%~ts&set t=!dt:~0,10!
    call :WriteFile %%~nxs %2 !t! "!dt!" %3 %%~xs %%~as
   )
   call :ForeachDirf %%a %2 %3   
  )
 )
goto :eof

rem 1 文件名 2 写入文件 3 10位日期 4 全日期 5 比较日期 6 后缀
:WriteFile
 if not "%3" equ "%5" (
  goto :eof
 ) 
 if not "%6" equ ".svn-base" (
  if not "%6" equ ".obj" (
   if not "%6" equ ".dll" (
    if not "%6" equ ".idb" (
     if not "%6" equ ".pdb" (
      if not "%6" equ ".ncb" (          
       if not "%6" equ ".exe" (
   echo   %1 %4
   set /a index=%index% + 1
   echo   %index% %1 %4 %7 >>%2
 )))))))

goto :eof