473,387 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Launching a console process and waiting till it finishes

Good morning all

I need a way in visual basic 6, to start a console process, like

ping -A xxx.xxx.xxx.xxx > outputfile.txt

and make vb hold its own execution till this process finishes. Using
Shell() doesnt work, it starts a process, then just carries on
working.

The ping example above uses the > outputfile.txt to grab all the
console output from that program, which i then read later on my
program.

Am I looking at using API calls for this?

Currently im using RetVal = Shell("CMD /S ping -A 123.456.123.456 >
outputfile.txt")

Outputfile.txt part works perfectly. But VB continues its processing
past my Shell call before the CMD window terminates.

Thanks
Rich
Jul 17 '05 #1
2 5610
th*************@hotmail.com (Richard) wrote in message news:<67**************************@posting.google. com>...
Good morning all

I need a way in visual basic 6, to start a console process, like

ping -A xxx.xxx.xxx.xxx > outputfile.txt

and make vb hold its own execution till this process finishes. Using
Shell() doesnt work, it starts a process, then just carries on
working.

The ping example above uses the > outputfile.txt to grab all the
console output from that program, which i then read later on my
program.

Am I looking at using API calls for this?


yes; go to http://groups.google.com and search for "vb shell wait" and
you should find lots of samples using the createprocess and other API
calls to do this.

BTW, you could also search for "vb icmp ping" and find sample code for
doing a ping directly from VB without needing to shell out at all.
Jul 17 '05 #2

"Richard" <th*************@hotmail.com> wrote in message
news:67**************************@posting.google.c om...
Good morning all

I need a way in visual basic 6, to start a console process, like

ping -A xxx.xxx.xxx.xxx > outputfile.txt

and make vb hold its own execution till this process finishes. Using
Shell() doesnt work, it starts a process, then just carries on
working.

The ping example above uses the > outputfile.txt to grab all the
console output from that program, which i then read later on my
program.

Am I looking at using API calls for this?

Currently im using RetVal = Shell("CMD /S ping -A 123.456.123.456 >
outputfile.txt")

Outputfile.txt part works perfectly. But VB continues its processing
past my Shell call before the CMD window terminates.

Thanks
Rich


Rich..

You may laugh at this.. but I had a similar problem a long time ago (it
wasn't ping but some other console command). I resorted to the old fashioned
batch file. After the command, the batch file would copy a file into a temp
directory.

In my code I simply check for that file, if it's there, it's completed. I
read the output file and delete the temp file.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: darknessfish | last post by:
Ok, I'm trying to write a basic scp scheduler, which will occasionally scan a directory, and use cygwin's scp.exe to copy the files to a Unix box. After various problems, the set up I've got now...
1
by: JC | last post by:
I'm trying to create a GUI wrapper for dumpbin, and so I'm using the Process class to run the command-line application. The problem is that if I use Readline() to get the output from the...
7
by: Ronnie Smith | last post by:
Hi, I have a console app written in C# to kill a certain process. I don't want the console to come to the foreground when run and I want it to exit itself without waiting for the 'Press any key...
1
by: John A. Bailo | last post by:
Excuse the novice aspects of this question, but: What techniques are available to me for launching one c# application ( console .exe) from another? For example, I know there is the Process and...
1
by: Water Cooler v2 | last post by:
I have a Windows Service I am writing in C# and a set of, let us say three, other executables written in C# (mostly console applications). I want that the Windows Service must do so every few...
3
by: Daniel Clark | last post by:
I have a Windows command line based application that only shuts down cleanly if it sees "CTRL-C" on the console. I need to automate the running of this application, but still allow the user sitting...
0
by: jbenezech | last post by:
Hi all , I have a perl/java app running under Win32. The application consists of a perl service (Win32::Daemon) and of java classes. The perl service calls every xx hours java classes to perform...
12
by: Dilip | last post by:
Hi All I have a server based C# console application. This application must hide its console window when its launched out on the field. So I dutifully P/Invoke'd FindWindow/ShowWindow...
9
by: erikcw | last post by:
Hi, I have a cgi script where users are uploading large files for processing. I want to launch a subprocess to process the file so the user doesn't have to wait for the page to load. What is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.