Convert .bat file to .vbs format

Hello Experts,

I need to convert the following .bat file to a .vbs format

"c:\python25\python.exe" "c:\python25\" -H -U root -P file:"c:\python25\host_pass.txt" -V auto

Open in new window

Could some please give me a hand with this? I am a novice at scripting :)
Who is Participating?
Bill PrewCommented:
Here's the basic idea.  This will run that EXE and wait for it to finish.  More info on the Run method here:

Set objShell = WScript.CreateObject("WScript.Shell")

strCommand = Quote("c:\python25\python.exe") & " " & Quote("c:\python25\") & " -H -U root -P file:" & Quote("c:\python25\host_pass.txt") & " -V auto"

objShell.Run(strCommand, 1, True)

' Add surrounding double quotes to a string
Function Quote(s)
   Quote = Chr(34) & s & Chr(34)
End Function

Open in new window

JohnnyD74Author Commented:
Thanks Bill!

It worked perfectly except for an error I got suggesting I needed to remove the parenthesis from line 5. I did so and it is working perfectly now!

Thanks Again,

Bill PrewCommented:
Ah yes, I often forget the subtle difference when calling a function using a return code, versus not.  Glad you sorted that out, and this was useful.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.