October 25, 2005 at 10:15 am
Hello,
I am trying to write a script to read files (SQL Scripts) under a folder. Here is what I am trying, I am stuck at being able to successfully execute the command.
option explicit
On Error Resume Next
Dim fso
Dim folderPath
Dim folder
Dim fileCol
Dim file
Set fso = createObject ("Scripting.FileSystemObject")
folderPath = "DatabaseScripts\"
Set folder = fso.getFolder(folderPath)
Set fileCol = folder.Files
Dim wShell
Set wShell = CreateObject("WScript.Shell")
For each file in fileCol
Wscript.Echo "osql /E -S .\I1 /i " & file.Name
wShell.run ("%compsec% /c osql /E -S .\I1 /i " & file.Name)
Next
wscript.echo ("Clear!")
Set fso=nothing
Thank you for your help.
-R
October 25, 2005 at 10:27 am
Dim s
For each file in fileCol
Wscript.Echo "osql /E -S .\I1 /i " & folderPath & "\" & file.Name
s = "osql /E -S .\I1 /i " & folderPath & "\" & file.Name
wShell.Open s
Next
This fixed the problem.
Thank you folks.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply