Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Agent
Starting Member
2 Posts |
Posted - 2004-10-14 : 05:56:55
|
HiI am trying to write a .vbs file that will retrive info from the computer filesystem object and then write that info directly into a sql table. The script is currently emailing me the results and I then copy them into the table Any ideas on how to write a vb script to do this.Thanks |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-10-14 : 06:52:30
|
| Open a database connection and INSERT the data into a table? Or am I missing the essence of what you need to do?Kristen |
 |
|
|
Agent
Starting Member
2 Posts |
Posted - 2004-10-14 : 07:11:01
|
| I don't know how to do it. I have only ever done it using ASP not windows scripting. Would you do it the same way? |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-10-14 : 09:24:57
|
Its pretty much identical, yes. There just isn't any RESPONSE.WRITE !There are two flavours (from a rather shakey memory, so this won't be gospel!)C> CSCRIPT MyScript.VBSandC> WSCRIPT MyScript.VBSone just runs from the command line, outputing anythign to DOS. The other sparks up a Window, outputting to that instead. There is different syntax for each method for actually outputing text.http://www.devguru.com/Technologies/wsh/quickref/wsh_intro.htmlandhttp://www.devguru.com/Technologies/vbscript/quickref/vbscript_intro.htmlwill probably give you some pointersAh ... here's a relevant bit:quote: An interesting aspect of WSH is that it contains two platform-specific executables, cscript.exe and wscript.exe. The echo (output) for cscript is to a command window (via a Win32 console application). While the echo (output) for wscript is to a graphical message box (via Windows). Just remember that the c stands for console and the w for Windows. For a full list of arguments, enter "cscript /?" or "wscript /?" at a command prompt.
Kristen |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-10-14 : 09:37:10
|
what filesystem info are you looking for??If it can be found using DOS commands?:Create Table #dirOutPut (id int identity(1,1), diroutput varchar(1000))Declare @dosStr varchar(1000)Set @dosStr = 'dir c:\'Insert Into #dirOutPutExec(@dosStr)Select * from #dirOutPutDrop Table #dirOutPut Corey |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2004-10-14 : 17:35:07
|
| Creating a .vbs-file is painstakingly easy. All you do is to create an asp-file that doesn print anything to the screen, make sure it works correctly, remove all <% and %> and all "Server" (i.e. Server.CreateObject("ADODB.Connection") => CreateObject("ADODB.Connection")) and save the file as .vbs. Works like a charm...--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-10-15 : 00:57:43
|
| And how enoying is the "remove all <% and %>" bit ... that means that we can't share include files between ASP and VBS </rant>... or can we?Kristen |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2004-10-15 : 04:00:05
|
| Nope, that's not possible...at least not that I know of. ASP has the Server.Execute("file.asp") that is almost like an include but not sure if Execute("file.asp") will work in a .vbs. Worth a try though.--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
|
|
|
|
|