Board index » Visual Studio » New User - Want to convert batch file to VBscript

New User - Want to convert batch file to VBscript

Visual Studio76
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


-
 

Re:New User - Want to convert batch file to VBscript



"WP" <wpilgri_at_@shaw.caa>wrote in message

Quote
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



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

examples?



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



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



Depends, but, yes, this is generally possible.



Quote
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





-

Re:New User - Want to convert batch file to VBscript

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 :

www.microsoft.com/technet/scriptcenter/scripts/default.mspx">www.microsoft.com/technet/scriptcenter/scripts/default.mspx

http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/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_@shaw.caa>wrote in message

Quote
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





-

Re:New User - Want to convert batch file to VBscript



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



cscript myfile.vbs>log.txt







-