Hi,
Running the following vbscript to call svnadmin dump fails (i.e. no dump is being created)
Set objShell = CreateObject("WScript.Shell")
Set objShellExec = objShell.Exec("svnadmin dump C:\svn_repos > C:\fullbackup")
I discovered from another post, http://stackoverflow.com/questions/445121/svn-dump-fails-with-wscript-shell/2400011#2400011 that i had to create a new command interpreter using cmd as follows:
Set objShellExec = objShell.Exec("%comspec% /c" & "svnadmin dump C:\svn_repos > C:\fullbackup")
This successfully created the dump but I could never read the output information (i.e. * Dumped revision 100. * Dumped revision 101. etc). I tried
Do While objWshScriptExec.Status = 0
Wscript.Echo objShellExec.StdOut.Readline
Wscript.Echo objShellExec.StdErr.Readline
WScript.Sleep 100
Loop
but nothing ever gets displayed.
May I know how i can read the output information and also why I needed to create a new command interpreter using "%comspec% /c" before the svnadmin dump command would execute correctly? Thanks.
Regards, Dexton
Edited Code:
Set objShell = CreateObject("WScript.Shell")
Set objFS = CreateObject("Scripting.FileSystemObject")
strOutput = "c:\svn_backup\fullbackupa"
Set objOutFile = objFS.CreateTextFile(strOutput,True)
Set objShellExec = objShell.Exec("%comspec% /c " & "svnadmin dump C:\svn_repos")
Do While objShellExec.Status = 0
stdoutline=objShellExec.StdOut.Readline
'Wscript.Echo stdoutline 'echo to standard output
Wscript.Echo objShellExec.StdErr.Readline
objOutFile.WriteLine(stdoutline & vbCrLf) 'write to file at the same time
WScript.Sleep 100
Loop
objOutFile.Close
Solution:
Set objShell = CreateObject("WScript.Shell")
Set objFS = CreateObject("Scripting.FileSystemObject")
strOutput = "c:\svn_backup\fullbackupa"
Set objOutFile = objFS.CreateTextFile(strOutput,True)
Set objShellExec = objShell.Exec("%comspec% /c " & "svnadmin dump C:\svn_repos > c:\svn_backup\fullbackupb")
Do While objShellExec.Status = 0
stdoutline=objShellExec.StdErr.Readline
Wscript.Echo stdoutline 'echo to standard output
'Wscript.Echo objShellExec.StdErr.Readline
objOutFile.WriteLine(stdoutline & vbCrLf) 'write to file at the same time
WScript.Sleep 100
Loop
objOutFile.Close