Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- ::-----------------------------------------------------------------------------------------------
- ::SCRIPT EXPLANATION
- :: This script will search for a file (in current directory) and provide the location,
- :: file size, and date/time last modified.
- ::------------------------------------------------------------------------------------------------
- ::MAIN SCRIPT
- :start
- cls
- set /p userfile="Which file to search?: "
- echo.
- ::***Search entire dir tree, set variable for location and folder (~dpG).***
- echo File location:
- dir /s /b "%userfile%" || echo. && pause && goto:start
- for /f "tokens=*" %%G in ('dir /s /b "%userfile%"') do set file1=%%G
- for /f "tokens=*" %%G in ('dir /s /b "%userfile%"') do set location=%%~dpG
- echo.
- ::***Set variable for file size (~zG) and variable for date/time modified (~tG)***
- for /f "tokens=*" %%G in ('dir /s /b "%file1%"') do set size=%%~zG
- echo Size: %size% bytes
- for /f "tokens=*" %%G in ('dir /s /b "%file1%"') do set timestamp=%%~tG
- echo Timestamp: %timestamp%
- echo.
- set /p open="Open file location (y/n)?: " || goto:start
- if %open%==y goto:open
- goto:start
- ::***Open folder (variable set in ~dpG)***
- :open
- cd %location%
- start.
- echo.
- pause
- goto:start
Advertisement
Add Comment
Please, Sign In to add comment