How to get the status of dos window

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
figjam420
Posts: 6
Joined: 21 Sep 2010 05:42

How to get the status of dos window

#1 Post by figjam420 » 12 Oct 2010 01:01

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 :D

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: How to get the status of dos window

#2 Post by !k » 12 Oct 2010 09:59

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

figjam420
Posts: 6
Joined: 21 Sep 2010 05:42

Re: How to get the status of dos window

#3 Post by figjam420 » 14 Oct 2010 08:27

Really it is amazing to find people so strong in dos :D . Hats off to you !k 8) . I am using your script and will get back to you if I have any doubts . Thanks again :D :D

figjam420
Posts: 6
Joined: 21 Sep 2010 05:42

Re: How to get the status of dos window

#4 Post by figjam420 » 14 Oct 2010 10:22

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

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: How to get the status of dos window

#5 Post by !k » 14 Oct 2010 10:43

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

figjam420
Posts: 6
Joined: 21 Sep 2010 05:42

Re: How to get the status of dos window

#6 Post by figjam420 » 14 Oct 2010 12:01

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?

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: How to get the status of dos window

#7 Post by !k » 17 Oct 2010 00:42

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

Post Reply