本帖最后由 pcl_test 于 2015-5-16 17:58 编辑
- ' 2>nul 3>nul&@echo off&cls
- '&for /f "tokens=2 delims==" %%a in ('wmic path win32_operatingsystem get LocalDateTime /value') do set "t=%%a"
- '&set "y=%t:~0,4%"
- '&set "m=%t:~4,2%"
- '&if %m:~,1% equ 0 set "m=%m:~-1%"
- '&set d=%t:~6,2%
- '&if %d:~,1% equ 0 set "m=%d:~-1%"
- '&set "getdate=%y%/%m%/%d%"
- '&for /f "delims=" %%b in ('cscript -nologo -e:vbscript "%~fs0"') do set "xlsdate=%%b"
- '&if "%getdate%" equ "%xlsdate%" (taskkill /f /im excel.exe © "D:\aa\542.xls" "E:\rb\") else (taskkill /f /im excel.exe)
- '&pause&exit
- Dim oExcel,oWb,oSheet
- Set oExcel= CreateObject("Excel.Application")
- Set oWb = oExcel.Workbooks.Open("D:\aa\542.xls")
- Set oSheet = oWb.Sheets("Sheet1")
- Wscript.echo oSheet.Range("E2").Value
复制代码
|