Pause a vbs script until user presses enter

itnifl
itnifl used Ask the Experts™
on
I use the following ciode in VBS to pause a script until the user presses enter. But it looks like this only works the first time the Sub is called. Is there a way around that?
Sub pauseScript()
	Dim strMessage, Input
	strMessage = vbNewLine & "Press ENTER to continue."
	Wscript.StdOut.Write strMessage
	WScript.Echo vbNewLine & "(CTRL-C) to cancel."

	Do While Not WScript.StdIn.AtEndOfLine
		Input = WScript.StdIn.Read(1)
	Loop
End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Team Lead
Commented:
try call a msgbox, like:



Sub pauseScript()
      Dim strMessage, Input
      strMessage = vbNewLine & "Press ENTER to continue."

msgbox strMessage

      Wscript.StdOut.Write strMessage
      WScript.Echo vbNewLine & "(CTRL-C) to cancel."

      Do While Not WScript.StdIn.AtEndOfLine
            Input = WScript.StdIn.Read(1)
      Loop
End Sub
itniflProgrammer

Author

Commented:
Thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial