[Windows] Help needed script will not run.

Come up with a useful post-processing script? Share it here!
Post Reply
relman
Release Testers
Release Testers
Posts: 46
Joined: September 30th, 2008, 2:42 am

[Windows] Help needed script will not run.

Post by relman »

Hi everyone, I am hoping someone can help me. I Have written a VBS script which takes command line arguments and then uses these as the values for an SQL insert statement. Running this from command prompt as; cscript sabnzbd.vbs one two three four  will then use the values one, two, three, four. So with this in mind a made a text file which says

Code: Select all

cscript C:\xsabnzbd.vbs %4 %3 %6 %1
However when I run this script it just hangs and in the history says "running script c:\sabnzbd.txt" and never works.  Has anyone got any ideas what I am doing wrong.

Here is the VBS

Code: Select all

Dim OdbcDSN
Dim connect, sql, resultSet

strNewzbinID = WScript.Arguments.Item(0)
strItemName = WScript.Arguments.Item(1)
strNewsGroup = WScript.Arguments.Item(2)
strFile_path = WScript.Arguments.Item(3)

OdbcDSN = "DSN=relnet;UID=dba;PWD=sql"
Set connect = CreateObject("ADODB.Connection")
connect.Open OdbcDSN

sql="INSERT INTO tvshow (tvshow_ref, show_name, file_path, Groups) VALUES ('" & strNewzbinID & "','"  & strItemName & "', '" & strFile_path & "', '" & strNewsGroup & "');commit"

Set resultSet = connect.Execute(sql)
On Error Resume Next
resultSet.MoveFirst


resultSet.Close

connect.Close
Set connect = Nothing

WScript.Quit(0)

]
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: [Windows] Help needed script will not run.

Post by shypike »

Don't tell me you named your script "c:\sabnzbd.txt"  :D

A command script should have a CMD extension, so "c:\sabnzbd.cmd".
Otherwise Windows won't know what to do with it.
If you're lucky it will start notepad.
relman
Release Testers
Release Testers
Posts: 46
Joined: September 30th, 2008, 2:42 am

Re: [Windows] Help needed script will not run.

Post by relman »

Sadly you were correct. I feel so stupid  :-[ . The script is now working correctly. Cheers!!!  :D
Post Reply