troubleshooting Question

Quit VB Script

Avatar of Rupert Eghardt
Rupert EghardtFlag for South Africa asked on
ProgrammingScripting LanguagesVB Script
9 Comments1 Solution767 ViewsLast Modified:
Hi Guys,

I have a small VB script that I'd like to use for sending out a test mail;

I'd like the script to close automatically when done sending,

At the moment it gives "Press any key to continue" at the end of the script and does not close the session window.

The script is as follows;

Option explicit
Dim oShell
set oShell= Wscript.CreateObject("WScript.Shell")
oShell.Run "telnet"
WScript.Sleep 1000
oShell.Sendkeys "open mail.server.co.za 25~"
WScript.Sleep 1000
oShell.Sendkeys "helo server.co.za~"
WScript.Sleep 1000
oShell.Sendkeys "mail from: sender@server.co.za~"
WScript.Sleep 1000
oShell.Sendkeys "rcpt to: recipient@server.co.za~"
WScript.Sleep 1000
oShell.Sendkeys "data~"
WScript.Sleep 1000
oShell.Sendkeys "Subject:Test Procedure Confirmation~"
WScript.Sleep 1000
oShell.Sendkeys "~"
WScript.Sleep 1000
oShell.Sendkeys "~"
WScript.Sleep 1000
oShell.Sendkeys "This is a confirmation of the Test procedure~"
WScript.Sleep 1000
oShell.Sendkeys ".~"
WScript.Sleep 1000
oShell.Sendkeys "quit~"
WScript.Sleep 1000
Wscript.Quit

* I've tried adding another QUIT to the end of the script, but doesn't help.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros