Page 1 of 1
How to get the status of dos window
Posted: 12 Oct 2010 01:01
by figjam420
I have a remote pc where a set of dos commands will be executing from time to time. Some times the dos window may wait as enter date and time or waiting for message and so on. I need a way log the status of the dos window(enter date and time or waiting for message) for every half an hour. Is this possible using batch files without using any third party tools
Thanks in advance
Re: How to get the status of dos window
Posted: 12 Oct 2010 09:59
by !k
In 1st batch:
Code: Select all
... some code ...
title Waiting for input
... code for enter ...
title Working
... some code ...
2nd batch:
Code: Select all
:loop
echo %date% %time% >>log
tasklist /v /fi "imagename eq cmd.exe" 2>nul |findstr /c:"Waiting for input" >nul &&echo Batch is waiting >>log ||echo. >>log
... code for 30 min delay ...
goto :loop
And
how do delay
Re: How to get the status of dos window
Posted: 14 Oct 2010 08:27
by figjam420
Really it is amazing to find people so strong in dos
. Hats off to you !k
. I am using your script and will get back to you if I have any doubts . Thanks again
Re: How to get the status of dos window
Posted: 14 Oct 2010 10:22
by figjam420
can u please explain me wat is happenning here. I am not able to understand this
2>nul |findstr /c:"Waiting for input" >nul &&echo Batch is waiting >>log ||echo. >>log
Re: How to get the status of dos window
Posted: 14 Oct 2010 10:43
by !k
My English is very poor, try read about "&&" and more running (on WinXP) this
Code: Select all
hh %windir%\Help\ntcmds.chm::/ntcmds_shelloverview.htm
Code: Select all
hh %windir%\Help\ntcmds.chm::/redirection.htm
Re: How to get the status of dos window
Posted: 14 Oct 2010 12:01
by figjam420
Great
Learnt a lot and got what I needed . Thanks a lot..
Only one problem is when I use tasklist with /s with a remote machine, in /v I am not able to get the windows title field. Is there any solution for this?
Re: How to get the status of dos window
Posted: 17 Oct 2010 00:42
by !k
Try
Code: Select all
tasklist /fi "windowtitle eq Waiting for input" 2>nul |findstr /bc:"cmd.exe" >nul &&echo Batch is waiting >>log ||echo. >>log