Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
figjam420
- Posts: 6
- Joined: 21 Sep 2010 05:42
#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
![Very Happy :D](./images/smilies/icon_biggrin.gif)
-
!k
- Expert
- Posts: 378
- Joined: 17 Oct 2009 08:30
- Location: Russia
#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
#3
Post
by figjam420 » 14 Oct 2010 08:27
Really it is amazing to find people so strong in dos
![Very Happy :D](./images/smilies/icon_biggrin.gif)
. Hats off to you !k
![Cool 8)](./images/smilies/icon_cool.gif)
. I am using your script and will get back to you if I have any doubts . Thanks again
![Very Happy :D](./images/smilies/icon_biggrin.gif)
-
figjam420
- Posts: 6
- Joined: 21 Sep 2010 05:42
#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
#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
#6
Post
by figjam420 » 14 Oct 2010 12:01
Great
![Smile :)](./images/smilies/icon_smile.gif)
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
#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