Computing Staff
  • 0

Batch File Open Last Modified File

  • 0

Hi,

I need to create a batch file to open the last modified excel file in a folder C:\Test\Unit 2. This folder also contained several sub-folders and the last modified file may exists in any of the sub-folders. I’ve been reading several posts in this forum on opening the latest modified file but still couldn’t find the solution. I’m using Windows 7 64-bit. Any help is very much appreciated

Thanks

Share

3 Answers

  1. Run this and post a few lines of the output.
    :: ==========================================
    ::
    :: bydate.bat Wed 25-05-2011 18:19:47.17
    @echo off & setLocal enableDELAYedeXpansioN

    for /f “tokens=* delims= ” %%a in (‘dir/b/s/a-d’) do (
    echo.%%~Ta %%a
    )

    • 0
  2. Dear M2
    I used

    do (
    start excel “%%a”
    goto :eof
    )

    instead of

    do (
    echo.%%~Ta %%a
    )

    and it works. Thanks a lot for your guidance

    • 0