Aug 14

We have a previous discussion of scheduled tasks here. A command prompt screen will “flash” when svhost executes the task and its a pain if you are working directly on that machine. Check this script:

Save this code as BatchLauncher.vbs

'--------------------code start<----------------------
sTitle = "Batch launcher"

Set oArgs = WScript.Arguments
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")

If oArgs.Count <> 1 Then
' Will die after 10 seconds if no one is pressing the OK button
oShell.Popup "Error: You need to supply a file path " _
& "as input parameter!", 10, sTitle, vbCritical + vbSystemModal

Wscript.Quit 1
End If

sFilePath = oArgs(0)

If Not oFSO.FileExists(sFilePath) Then
' Will die after 10 seconds if no one is pressing the OK button
oShell.Popup "Error: Batch file not found", _
10, sTitle, vbCritical + vbSystemModal

Wscript.Quit 1
End If

' add quotes around the path in case of spaces
iRC = oShell.Run("""" & sFilePath & """", 0, True)

' Return with the same errorlevel as the batch file had
Wscript.Quit iRC
'--------------------Code end<----------------------

'Note: It is the 0 in this line that hides the batch file execution:
'iRC = oShell.Run("""" & sFilePath & """", 0, True)
'If you want to run it visible, but minimized, change the 0 to 7.

Now update your task like this:


wscript "C:\svnlogs\BatchLauncher.vbs" "C:\svnlogs\start.bat"
Tagged with:
Aug 11

I have my web development team who are tired uploading their changes to our dev server, they are lazy? Well, yes. I have installed an svn server for them to monitor and track their changes. For them, updating, commiting and adding new file is a stress, and so I jumped into something that I think we should have here(spoiler act).

Our dev server is running on a windowsXP machine, truly, its just for testing ;-) , and to start the spoiler, here it is.

I made tow(2) batch files, one being called by the task scheduler(crontab for linux) and the execution of the update.

start.bat
@ECHO OFF
CLS
SET DD=%DATE:~7,2%
SET MM=%DATE:~4,2%
SET YYYY=%DATE:~10,4%
SET HH=%TIME:~0,2%
SET MN=%TIME:~3,2%
SET SS=%TIME:~6,2%
SET SAI="%YYYY%-%MM%-%DD%"
svn.bat > %SAI%.txt

I made this first script to be able to track the las sub version of the project daily.

svn.bat
@ECHO OFF
CD\
CD C:\WEBROOT\myProject
svn up

It’s easier to create this script in linux shell, but for those who are developing in windows platform, here’s your startpoint. :)

Add start.bat in your system’s taskscheduler. Execute it every 1minute or whatever delay you want. To check if your task is running, type:
$> schtasks /query
in commandline, you will see something like:
C:\Documents and Settings\Jay-ar>schtasks /query

TaskName                             Next Run Time            Status
==================================== ======================== ===============
start                                09:17:00, 8/11/2009
Tagged with:
preload preload preload
Bless CV