Link to home
Start Free TrialLog in
Avatar of oalvarado
oalvarado

asked on

Create a file with a batch

Hi, I need to create a batch that creates a txt file, here is the fun part the batch will run every 1 to 5 minutes (the time is not impotant)  and a new file will be created with a new name, this name has to be in sequence to the last one created or we can have the time it was created (HH:MM:SS)

thanks
ASKER CERTIFIED SOLUTION
Avatar of georg74
georg74

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of domj
domj

Hi guys,

Not shooting for points here but I came up against a similar issue with trying to date stamp a file and found this script which is quite cool. It puts all the different date/time parts into environment variables which can then be referenced using %DD%/%MM%/%YY% %HH%:%MIN%:%SS% or any other combo of these variables.

REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For /f "tokens=1-7 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do (
      For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
            set dow=%%i
            set %%a=%%j
            set %%b=%%k
            set %%c=%%l
            set hh=%%m
            set min=%%n
            set ss=%%o
      )
)
if %HH%==10 goto end
if %HH%==11 goto end
if %HH%==12 goto end
set HH=0%HH%

:end
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dom