473,545 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Launch a program with command line arguments

Hey guys,

I need to launch an external application, but I need to launch it with some
command line arguments. Now the thing is that I need to launch it as a
process. For example:

Dim p As New System.Diagnost ics.Process
Dim s As New System.Diagnost ics.ProcessStar tInfo("C:\My Path\MyFile.exe ")
Try
s.UseShellExecu te = True
s.WindowStyle = ProcessWindowSt yle.Normal
p.StartInfo = s
p.Start()
Catch ex As Exception
HandleError(ex)
End Try
p = Nothing
s = Nothing

This will cause the operating system to launch the file with the default
handler program, but it gives me an error because of the command line
arguments.

Any ideas on how to accomplish this?

Thanks!
Nov 20 '05 #1
1 1563
In article <OA************ **@TK2MSFTNGP09 .phx.gbl>, Juan Romero wrote:
Hey guys,

I need to launch an external application, but I need to launch it with some
command line arguments. Now the thing is that I need to launch it as a
process. For example:

Dim p As New System.Diagnost ics.Process
Dim s As New System.Diagnost ics.ProcessStar tInfo("C:\My Path\MyFile.exe ")
Try
s.UseShellExecu te = True
s.WindowStyle = ProcessWindowSt yle.Normal
' set the command line
s.Arguments = "CommandLin e Arguments"
p.StartInfo = s
p.Start()
Catch ex As Exception
HandleError(ex)
End Try
p = Nothing
s = Nothing

This will cause the operating system to launch the file with the default
handler program, but it gives me an error because of the command line
arguments.

Any ideas on how to accomplish this?

Thanks!

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #2

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

Similar topics

2
4175
by: SunRise | last post by:
Hi I am creating a C Program , to extract only-Printable-characters from a file ( any type of file) and display them. OS: Windows-XP Ple help me to fix the Errors & Warnings and explain how to use Command-Line Arguments inside C program.
1
1990
by: john conwell | last post by:
I've got a process engine written in .Net. the user writes a data file and saves it as file type ".xyz". I have a file assiciation set up in the database that when a .xyz file is invoked (double click or called in cmd prompt) it passed to my process engine executable as a cmd line parm. so the process engine gets one argument, which is the...
9
2344
by: santosh | last post by:
Hello all, I've put together a small program to count the number of characters and 'words' in a text file. The minimum length of a word, (in terms of no. of characters), as well as word delimiting characters can be specified on the command line. The default delimiting characters built into the program are space, newline, tab, carriage...
2
1102
by: bidalah | last post by:
Hi, I have created a program which opens up ".pcfs" files, a kind of text file unique to my program. I want to be able to click on these files and have the program launch AND load the contents of the clicked file. I have been able to do the first half. I can click on a .pcfs file and the program comes up. But how do I make the program...
26
2799
by: Martin Jørgensen | last post by:
Hi, I'm learning C-programming. I have a program which I would like to modify so it takes arguments from the commandline. Let call the program: program.exe. Could somebody shortly explain how I get this behaviour: C:>program -help or C:>program -h printf("\nBla. bla. Here is some help and arguments\n").... etc.
8
1978
by: Marcus | last post by:
I have this application I have made that I launch when the user logs into Windows XP. I would like to delay the launch of the application so that it starts 1 minute after the user has logged in. I previously did this with a sleep at the first row of the source code, but this makes the process visible in the task manager's processes tab...
5
1994
by: stef mientki | last post by:
hello, I'm trying to launch a windows application, but as many others on this list, I've some trouble. I read some other threads about this topic, but sorry, I still don't understand all this (never heard of pipes). When I use a batch file, I can launch the bat-file from python, and the windows application launched from the batchfile is...
7
9340
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should display the Windows form. The form is being displayed but the command only returns when the form is closed. I want the command line to return...
0
7415
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...
1
7440
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...
0
7775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5997
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...
1
5344
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...
0
4963
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...
0
3470
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...
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
726
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...

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.