Record Minutes Every 30 Minutes

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
dockies
Posts: 2
Joined: 25 Jan 2011 03:06

Record Minutes Every 30 Minutes

#1 Post by dockies » 25 Jan 2011 03:15

Hi,

I am a newbie when it comes to batch script, im trying to google everything that i need it's just so confusing for me and really dont have any idea how the batch works :(

Well if anyone here is kind enough to help me... this is my problem:

I need to record the minutes every 30 mins. given that the pc is turned on :D

Example:
i have a text file let say "minutes.txt"

Every 30 Minutes the script will record something like this...

>> 30 Minutes

After 30 Minutes

>> 60 Minutes

It should be in the same file. it doesn't matter if it overwrites the file or just write a new line or record inside the file.
And is it possible for a batch script to run without opening anything like DOS prompt? it will run in the background and no one
will see any difference in their screen.

Please i really need help for this :cry:

Thanks in advance.... :mrgreen:

ChickenSoup
Posts: 79
Joined: 13 Dec 2010 10:32

Re: Record Minutes Every 30 Minutes

#2 Post by ChickenSoup » 25 Jan 2011 08:18

Do you want the batch file to count down to the next 30 minute interval, or are you using something like the windows Task Scheduler to launch the batch file every 30 minutes?
Also, the only way to do it completely hidden is with vbScript that calls the batch (or do the whole thing in vbs).

dockies
Posts: 2
Joined: 25 Jan 2011 03:06

Re: Record Minutes Every 30 Minutes

#3 Post by dockies » 25 Jan 2011 22:51

Actually either way... as of now i am using task scheduler to run the script every 30 mins.

Yes i googled it already and this is what i have so far.

runme.bat

Code: Select all

@ECHO OFF
CLS
wscript.exe "invis.vbs" "minutes.bat"
CLS


invis.vbs

Code: Select all

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False


minutes.bat

Code: Select all

echo 1 >> minutes.txt


yes it is writing in the file every 30 minutes the problem is the command promt screen still shows. :(

Thank you for your reply... hope to solve this soon :o

ChickenSoup
Posts: 79
Joined: 13 Dec 2010 10:32

Re: Record Minutes Every 30 Minutes

#4 Post by ChickenSoup » 26 Jan 2011 08:27

You are still seeing the command window because you are using a batch file to launch another batch file hidden.

Try RunMeHidden.vbs in your scheduled task:

Code: Select all

CreateObject("Wscript.Shell").Run "C:\Path\To\File\minutes.bat", 0, False

ChickenSoup
Posts: 79
Joined: 13 Dec 2010 10:32

Re: Record Minutes Every 30 Minutes

#5 Post by ChickenSoup » 26 Jan 2011 08:36

And for the minutes file to look how you originally posted.
Minutes.bat

Code: Select all

for /f "tokens=1" %%a in (minutes.txt) do set minutes=%%a
set /a minutes=%minutes%+30
echo.%minutes% minutes>>minutes.txt

Post Reply