469,138 Members | 1,380 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,138 developers. It's quick & easy.

keep the DOS window open after running Call Shell command

I recently resolved an issue I had with passing a variable to a call
shell command, but now I need it to pause or leave the window open so I
can manually close it. Below is my code, and I am not sure where to
begin to keep the DOS window from closing.

Dim stAppName As String
Dim stIPAddress As String

stAppName = "C:\WINDOWS\system32\ping.exe "
stIPAddress = [IPAddress]
Call Shell(stAppName & stIPAddress, 1)

So what happens is a DOS window opens up and pings the ip address that
is listed in the form field, and once the command finishes the DOS
window closes. I would like for the DOS window to stay open.

Thanks,

Tripwire

Nov 13 '05 #1
2 20462
tr*****@gmail.com wrote:
I recently resolved an issue I had with passing a variable to a call
shell command, but now I need it to pause or leave the window open so I
can manually close it. Below is my code, and I am not sure where to
begin to keep the DOS window from closing.

Dim stAppName As String
Dim stIPAddress As String

stAppName = "C:\WINDOWS\system32\ping.exe "
stIPAddress = [IPAddress]
Call Shell(stAppName & stIPAddress, 1)

So what happens is a DOS window opens up and pings the ip address that
is listed in the form field, and once the command finishes the DOS
window closes. I would like for the DOS window to stay open.

Thanks,

Tripwire


Shell Environ$("COMSPEC") & " /k " & strAppNAme & strIPAddress,1
will keep the dos box open at the command prompt, you can carry on and
type other commands into that box until you type "exit".

Or you can
stAppName = "C:\WINDOWS\system32\ping.exe -t "

Then it will ping until you press Ctrl+C

--
[Oo=w=oO]

Nov 13 '05 #2
Used the Shell Environ$("COMSPEC") & " /k ping """ & stIPAddress, 1
and this worked great! Thanks for the help.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by BlackHawke | last post: by
5 posts views Thread by Stefano Tonello | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.