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
How to get the status of dos window
Moderator: DosItHelp
Re: How to get the status of dos window
In 1st batch:
2nd batch:
And how do delay
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
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
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
2>nul |findstr /c:"Waiting for input" >nul &&echo Batch is waiting >>log ||echo. >>log
Re: How to get the status of dos window
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
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?
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
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