本帖最后由 terse 于 2013-9-23 14:07 编辑
回复 13# lion991128
文件名含当天日期- @echo off
- set "flag="
- set reg=reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
- set dt=%date:~,10%
- for /f "skip=4 tokens=2*" %%i in ('%reg% /v "desktop"') do (
- for /f "tokens=*" %%k in ("%%j") do set "desktop=%%k"
- )
- for /f "delims=" %%i in ('findstr /im "ERROR" *.log^|findstr "%dt:-=-*%"') do (
- copy "%%i" "%desktop%"
- set flag=rundll32.exe user32.dll,LockWorkStation
- )
- %flag%
- pause
复制代码 文件内容含当天日期- @echo off
- set "flag="
- set reg=reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
- set dt=%date:~,10%
- for /f "skip=4 tokens=2*" %%i in ('%reg% /v "desktop"') do (
- for /f "tokens=*" %%k in ("%%j") do set "desktop=%%k"
- )
-
- for /f "delims=" %%i in ('findstr /im "%dt:-=-*%" *.log') do (
- findstr /im ERROR "%%i" >nul && (
- copy "%%i" "%desktop%"
- set flag=rundll32.exe user32.dll,LockWorkStation
- )
- )
- %flag%
- pause
复制代码 当天日期文件- @echo off
- set "flag="
- set reg=reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
- for /f "skip=4 tokens=2*" %%i in ('%reg% /v "desktop"') do (
- for /f "tokens=*" %%k in ("%%j") do set "desktop=%%k"
- )
- for /f "delims=" %%i in ('findstr /im "ERROR" *.log') do (
- for /f %%j in ("%%~ti") do (
- if /i "%%j" == "%date:~,10%" (
- copy "%%i" "%desktop%"
- set flag=rundll32.exe user32.dll,LockWorkStation
- )
- )
- )
- %flag%
- pause
复制代码
|