Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi there,
is it possible to start a batch-program, that
always writes something into a logfile and runs in background, while another application
is running ?
I have to add this job, because an applications crashes sometimes, when there is for 15 minutes nothing to be done. So I want, that a batchjob writes always something in a file to let the harddisk something to do.Is it possible ?
Or what else can I do ?Greetinxx
JENS

That's only possible under Windows, since multitasking isn't possible under DOS.
Here's a sample a batch file which would write a little bit to the hard disk every 60 seconds:
@echo off
echo Type X to exit.
:loop
CHOICE /c-X /n /t-,60 > nul
if errorlevel=2 goto end
dir |REM
goto loop
:endThe amount which is written is very small. You could change that, mayky on the line with the pipe (|). For instance, change that line by "dir/s \ |REM".
That batch will fail under NT system. If you want the batch to make a continuos task, try this second one:
@echo off
echo To exit, hit CTRL+BREAK repeatedly.
:loop
dir/s \|REM
goto loopAbout running it on batckground, right-click on the file and select "properties". From there, you'll be able to make it run minimized.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

Ooops, Jens said "15 minutes". So, this script should do it:
@echo off
echo Type X to exit.
set T=
:loop
CHOICE /c-X /n /t-,60 > nul
if errorlevel=2 goto end
set T=.%T%
if not "%T%"=="..............." goto loop
dir/s \ |REM
set T=
goto loop
:end
set T=That won't work under NT systems.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |