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
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
Thanks in advance....
Record Minutes Every 30 Minutes
Moderator: DosItHelp
-
- Posts: 79
- Joined: 13 Dec 2010 10:32
Re: Record Minutes Every 30 Minutes
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).
Also, the only way to do it completely hidden is with vbScript that calls the batch (or do the whole thing in vbs).
Re: Record Minutes Every 30 Minutes
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
invis.vbs
minutes.bat
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
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
-
- Posts: 79
- Joined: 13 Dec 2010 10:32
Re: Record Minutes Every 30 Minutes
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:
Try RunMeHidden.vbs in your scheduled task:
Code: Select all
CreateObject("Wscript.Shell").Run "C:\Path\To\File\minutes.bat", 0, False
-
- Posts: 79
- Joined: 13 Dec 2010 10:32
Re: Record Minutes Every 30 Minutes
And for the minutes file to look how you originally posted.
Minutes.bat
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