473,626 Members | 3,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Launching An External Program

I am trying to launch an external program within Visual Basic 2005 Express.
If it is a simple program it works well with:-

myProg = "C:\MyFolder\My App.exe"
System.Diagnost ics.Process.Sta rt(myProg)

However, the application in question needs various command line arguments
added when it is launched, such as:-

"C:\MyFolder\My App.exe -h 9 -r 55 -j testfile.abc"

When I try this a Win32Exception was handled because it says it cannot find
the file specified. I am sure the problem is in how the arguments are
handled. Any ideas please?

Nov 21 '05 #1
8 2208
Keith French wrote:
I am trying to launch an external program within Visual Basic 2005 Express.
If it is a simple program it works well with:-

myProg = "C:\MyFolder\My App.exe"
System.Diagnost ics.Process.Sta rt(myProg)

However, the application in question needs various command line arguments
added when it is launched, such as:-

"C:\MyFolder\My App.exe -h 9 -r 55 -j testfile.abc"

When I try this a Win32Exception was handled because it says it cannot find
the file specified. I am sure the problem is in how the arguments are
handled. Any ideas please?


Are you just changing your myProg string to include MyApp's arguments?

Have you tried setting the arguments with Process's 'startInfo.Argu ments'?

Nov 21 '05 #2
"Keith French" <ke*********@bt connect.com> schrieb:
I am trying to launch an external program within Visual Basic 2005 Express.
If it is a simple program it works well with:-

myProg = "C:\MyFolder\My App.exe"
System.Diagnost ics.Process.Sta rt(myProg)

However, the application in question needs various command line arguments
added when it is launched, such as:-

"C:\MyFolder\My App.exe -h 9 -r 55 -j testfile.abc"

Check out 'Process.Start( <file name>, <arguments>)' .

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
No I haven't tried that. Can you give me the syntax or point me to a good
web reference please?
"beaker" <bl******@rhuba rbrhubarbblahbl ah.net> wrote in message
news:en******** ******@tk2msftn gp13.phx.gbl...
Keith French wrote:
I am trying to launch an external program within Visual Basic 2005
Express. If it is a simple program it works well with:-

myProg = "C:\MyFolder\My App.exe"
System.Diagnost ics.Process.Sta rt(myProg)

However, the application in question needs various command line arguments
added when it is launched, such as:-

"C:\MyFolder\My App.exe -h 9 -r 55 -j testfile.abc"

When I try this a Win32Exception was handled because it says it cannot
find the file specified. I am sure the problem is in how the arguments
are handled. Any ideas please?


Are you just changing your myProg string to include MyApp's arguments?

Have you tried setting the arguments with Process's 'startInfo.Argu ments'?

Nov 21 '05 #4
"Keith French" <ke*********@bt connect.com> schrieb:
No I haven't tried that. Can you give me the syntax or point me to a good
web reference please?


..NET Framework Class Library -- 'ProcessStartIn fo' Class
<URL:http://msdn.microsoft. com/library/en-us/cpref/html/frlrfsystemdiag nosticsprocesss tartinfoclassto pic.asp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
Thanks for that it now handles the arguments fine using:-

'Process.Start( <file name>, <arguments>)

However, the program I am launching is a DOS program and you stop its
display with CTRL-C, which works, the problem is this also closes the
command prompt window it runs it. I need to see some output of the results
of this program and hence need to keep the window open.

Is there a way of doing this as well?
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:Og******** ******@TK2MSFTN GP14.phx.gbl...
"Keith French" <ke*********@bt connect.com> schrieb:
I am trying to launch an external program within Visual Basic 2005
Express. If it is a simple program it works well with:-

myProg = "C:\MyFolder\My App.exe"
System.Diagnost ics.Process.Sta rt(myProg)

However, the application in question needs various command line arguments
added when it is launched, such as:-

"C:\MyFolder\My App.exe -h 9 -r 55 -j testfile.abc"

Check out 'Process.Start( <file name>, <arguments>)' .

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6
Keith,

"Keith French" <ke*********@bt connect.com> schrieb:
However, the program I am launching is a DOS program and you stop its
display with CTRL-C, which works, the problem is this also closes the
command prompt window it runs it. I need to see some output of the results
of this program and hence need to keep the window open.


You could redirect the application's output:

<URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole .zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #7
Thanks for that it works now. The only thing is that I have to terminate my
DOS program with CTRL-C, which should just stop it running and not close the
window. This way you can read the results from its run. Is there a way to
keep the window open? What about running "cmd.exe" as the program and my
program as arguments off of CMD.exe?

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:Og******** ******@TK2MSFTN GP14.phx.gbl...
"Keith French" <ke*********@bt connect.com> schrieb:
I am trying to launch an external program within Visual Basic 2005
Express. If it is a simple program it works well with:-

myProg = "C:\MyFolder\My App.exe"
System.Diagnost ics.Process.Sta rt(myProg)

However, the application in question needs various command line arguments
added when it is launched, such as:-

"C:\MyFolder\My App.exe -h 9 -r 55 -j testfile.abc"

Check out 'Process.Start( <file name>, <arguments>)' .

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #8
"Keith French" <ke*********@bt connect.com> schrieb:
Thanks for that it works now. The only thing is that I have to terminate
my DOS program with CTRL-C, which should just stop it running and not
close the window. This way you can read the results from its run. Is there
a way to keep the window open?
I don't know if this is possible, but I assume it's not.
What about running "cmd.exe" as the program and my program as arguments
off of CMD.exe?


"cmd.exe" doesn't expect a file to run as parameter, IIRC. However, you
could create a batch file which starts the executable and then uses 'PAUSE'
to keep the console open.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #9

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

Similar topics

4
3277
by: m11533 | last post by:
I am writing a fairly complex application in c# and Visual Studio .Net 2003. Right now I am working on a simple console application (to be launched in the future from a service) that receives messages sent via IP from an external device. I am also writing a simulator of that external device. My question: How do I setup the Visual Studio so that when I start debugging my c# application, both my message sink AND simulator are launched? I...
4
3467
by: dvestal | last post by:
How can I launch a .NET executable (a windows app written in VB.NET) from within another .NET assembly, and be able to tell when the user receives control? I could just kick it off with System.Diagnostics.Process.Start, but it has a lengthy loading sequence, and I wouldn't know when it was loaded. So, is it be possible to launch the app and trap the main form's Activate event? Is there an easier way?
0
1694
by: Scott Zabolotzky | last post by:
I'm using the following code to launch SIGNCODE.EXE to sign a CAB provisioning file from an ASP.NET app. When I run the code the exit code comes back as -1. I have not been able to determine what this exit code means (other than Error, as the CAB file does not get signed). No exceptions are thrown and I've verified that the app can read and write to the c:\mps\provdata directory. It seems as if it's not a permissions problem as the...
7
2829
by: dhussong | last post by:
I have created a Setup and Deployment project in Visual Studio.NET 2003. After my installation has completed running I'd like to launch the EXE that I just installed. I've found how to launch the EXE in the Custom Actions area of the Setup and Deployment project. Unfortunately when the EXE is launched it causes the setup program to stay open until the EXE has been exited. Anyone have any ideas how to launch the EXE and get the setup...
0
861
by: Jarrod Morrison | last post by:
Hi All Im a bit of a newbie to the .Net way of programming and am looking for a way to launch a program from a service program running on my winxp machine. I have tried a few methods but all launch as the local system user. I want one that launches as the logged on user of the machine and not local system. Should i be investigating impersonation ? Any help is greatly appreciated Thanks
1
1378
by: FinallyInSeattle | last post by:
I need to be able to make a registry change (trust me, I don't like it either) and then launch an external .EXE from a small C# program. I've done a Process.Start, but when my program exits the external .EXE is exited/shutdown as well. What can I used to I start it up and keep it running even after my program ends?
2
5316
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
8
2276
by: =?iso-8859-1?B?QW5kcuk=?= | last post by:
I would like to find out how I can launch an independent Python program from existing one in a cross-platform way. The result I am after is that a new terminal window should open (for io independent of the original script). The following seems to work correctly under Ubuntu and Windows ... but I haven't been able to find a way to make it work under Mac OS. def exec_external(code, path): """execute code in an external process
6
1694
by: PsamtikNerd | last post by:
I need to know how to launch an external application using a parameter specified in my program. More specifically, the user enters a string, and my program will execute "cd <string>". Anyone know how I can do this?
0
8203
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8642
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8368
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.