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\check_esxi_hardware.py" -H 192.168.0.15 -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 :)
JohnnyD74Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
Here's the basic idea.  This will run that EXE and wait for it to finish.  More info on the Run method here:

http://msdn.microsoft.com/en-us/library/d5fk67ky%28VS.85%29.aspx

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

strCommand = Quote("c:\python25\python.exe") & " " & Quote("c:\python25\check_esxi_hardware.py") & " -H 192.168.0.15 -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

~bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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,

John
0
Bill PrewIT / Software Engineering ConsultantCommented:
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.

~bp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.