From: WP on
I currently have a batch file that runs every night to perform a backup.
It does something like this:
rem Prepare Oracle service
call ShutdownService.bat
call exportdata.bat
call ZipFilesToBackupDir.bat
call RestartService.bat

Now because the ShutdownService.bat and RestartService.bat come with the
database they cannot be changed. I would like to add one enhancement to
it when converting to a VBS. I want to make a directory that has
today's date and store all the output from the batch file in that
directory. It should go something like this:
call ShutdownService.bat
Make Directory for today 'ie: mkdir 20050207
exportdata.bat 'store in 20050207 directory
ZipFilesToBackupDir
call RestartService.bat

I know some VB but have never even thought about using VBScript so I
could use some help.

Q1: Can I call several .BAT files easily from within my VBS? Any examples?

Q2: Can I redirect all output from the VBS to a text log file?

Q3: Any good reference material I should be reviewing?

Thank You
From: Al Dunbar [MS-MVP] on

"WP" <wpilgri_at_(a)shaw.caa> wrote in message
news:uXsz7KYDFHA.3108(a)TK2MSFTNGP10.phx.gbl...
> I currently have a batch file that runs every night to perform a backup.
> It does something like this:
> rem Prepare Oracle service
> call ShutdownService.bat
> call exportdata.bat
> call ZipFilesToBackupDir.bat
> call RestartService.bat
>
> Now because the ShutdownService.bat and RestartService.bat come with the
> database they cannot be changed. I would like to add one enhancement to
> it when converting to a VBS. I want to make a directory that has
> today's date and store all the output from the batch file in that
> directory. It should go something like this:
> call ShutdownService.bat
> Make Directory for today 'ie: mkdir 20050207
> exportdata.bat 'store in 20050207 directory
> ZipFilesToBackupDir
> call RestartService.bat
>
> I know some VB but have never even thought about using VBScript so I
> could use some help.

To be honest, if you are running batch files, and you have a batch file that
is running them, there might be relatively little actual benefit in
converting to vbscript. All you would need to do would be to add a batch
file that creates the required folder named for the current date. This is a
question asked numerous times per day in NT-related batch newsgroups such
as:

microsoft.public.win2000.cmdprompt.admin
microsoft.public.windows.server.scripting

> Q1: Can I call several .BAT files easily from within my VBS? Any
examples?

Yes. No, I have no examples on me at present.

> Q2: Can I redirect all output from the VBS to a text log file?

Depends, but, yes, this is generally possible.

> Q3: Any good reference material I should be reviewing?

Depends. How much MORE do you want to learn than "just enough to solve this
problem"?

/Al


From: Chris V. on
Q1 :
Set objShell = CreateObject("WScript.Shell")

StrCommandLine = "MyBatch.bat <%1> <%2>"
Set objExecObject = objShell.Exec (StrCommandLine)

Q2 :
If you are using Batch files, use
StrCommandLine = "MyBatch.bat <%1> <%2> >>MyLogFile.txt"
Q3 :
http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsoriwshlanguagereference.asp

+ Download the file "Windows Script V5.6 Documentation" (can't find the link
anymore)

Chris

"WP" <wpilgri_at_(a)shaw.caa> wrote in message
news:uXsz7KYDFHA.3108(a)TK2MSFTNGP10.phx.gbl...
> I currently have a batch file that runs every night to perform a backup.
> It does something like this:
> rem Prepare Oracle service
> call ShutdownService.bat
> call exportdata.bat
> call ZipFilesToBackupDir.bat
> call RestartService.bat
>
> Now because the ShutdownService.bat and RestartService.bat come with the
> database they cannot be changed. I would like to add one enhancement to
> it when converting to a VBS. I want to make a directory that has
> today's date and store all the output from the batch file in that
> directory. It should go something like this:
> call ShutdownService.bat
> Make Directory for today 'ie: mkdir 20050207
> exportdata.bat 'store in 20050207 directory
> ZipFilesToBackupDir
> call RestartService.bat
>
> I know some VB but have never even thought about using VBScript so I
> could use some help.
>
> Q1: Can I call several .BAT files easily from within my VBS? Any
examples?
>
> Q2: Can I redirect all output from the VBS to a text log file?
>
> Q3: Any good reference material I should be reviewing?
>
> Thank You


From: Agoston Bejo on

> > Q2: Can I redirect all output from the VBS to a text log file?

cscript myfile.vbs >log.txt