473,402 Members | 2,050 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,402 software developers and data experts.

exe file geting a parameter from the command lie

i need a exe file that will take a parameter from the command line and
launch the default application that the user has to plays a video file (the
param from command file). and then the exe files finishes.

is that possible. ? how can i do it ? links? articles ?

thanks!
Nov 15 '05 #1
6 4287
rodrigo guerra <em************@yahoo.com> wrote:
i need a exe file that will take a parameter from the command line and
launch the default application that the user has to plays a video file (the
param from command file). and then the exe files finishes.

is that possible. ? how can i do it ? links? articles ?


Getting parameters from the command line is easy - just make your Main
method take a string array as an argument. For instance:

using System;

class Test
{
static void Main (string[] args)
{
Console.WriteLine ("{0} arguments provided:");
foreach (string arg in args)
{
Console.WriteLine (arg);
}
}
}

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
Jon Skeet [C# MVP] <sk***@pobox.com> wrote:

Apologies, there was a bug in my code. This line:
Console.WriteLine ("{0} arguments provided:");


should have read:

Console.WriteLine ("{0} arguments provided:", args.Count);

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3
hi jon, thanks for the feedback.

but what about the second part ?
take this parameter (will be a string from a video file "myVideo.mpeg" and
launching in the user´s default player. it would be difficult to do this ?

thanks!

"Jon Skeet [C# MVP]" <sk***@pobox.com> escreveu na mensagem
news:MP************************@msnews.microsoft.c om...
Jon Skeet [C# MVP] <sk***@pobox.com> wrote:

Apologies, there was a bug in my code. This line:
Console.WriteLine ("{0} arguments provided:");


should have read:

Console.WriteLine ("{0} arguments provided:", args.Count);

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #4

"rodrigo guerra" <em************@yahoo.com> wrote in message
news:uW**************@TK2MSFTNGP10.phx.gbl...
i need a exe file that will take a parameter from the command line and
launch the default application that the user has to plays a video file (the param from command file). and then the exe files finishes.

is that possible. ? how can i do it ? links? articles ?

thanks!


Running the default associated program is also easy..

Use the System.Diagnostics.Process class.. Then set the StartInfo to the
name of the file you want to run then it'll start the correct exe for that
file.

Simon.
Nov 15 '05 #5
rodrigo guerra <em************@yahoo.com> wrote:
but what about the second part ?
take this parameter (will be a string from a video file "myVideo.mpeg" and
launching in the user´s default player. it would be difficult to do this ?


Look at System.Diagnostics.Process. I can't remember offhand whether
you need to explicitly use something to do the equivalent of "start"
under the command prompt, or whether you can just give the filename -
either way, it may well not work on 98.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #6
thanks for the System.Diagnostics.Process class tip, i´m gonna look for it.

[]´s rodrigo.

"Simon Johnson" <ck***@hotmail.com> escreveu na mensagem
news:br**********@titan.btinternet.com...

"rodrigo guerra" <em************@yahoo.com> wrote in message
news:uW**************@TK2MSFTNGP10.phx.gbl...
i need a exe file that will take a parameter from the command line and
launch the default application that the user has to plays a video file

(the
param from command file). and then the exe files finishes.

is that possible. ? how can i do it ? links? articles ?

thanks!


Running the default associated program is also easy..

Use the System.Diagnostics.Process class.. Then set the StartInfo to the
name of the file you want to run then it'll start the correct exe for that
file.

Simon.

Nov 15 '05 #7

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

Similar topics

17
by: George | last post by:
Newbie question: I'm trying to lauch Notepad from Python to open a textfile: import os b1="c:\test.txt" os.system('notepad.exe ' + b1) However, the t of test is escaped by the \, resulting...
3
by: Me | last post by:
hi, I have this file I need to execute from an ASP client. since we have installed it on the SQL Database server machine, I thought I could run it like this: Set Cn =...
14
by: vbMark | last post by:
Greetings, This seems like it should be simple but I can't figure out how to do this. I just want to append binary file 2 on to the end of binary file 1. Sample code please? Thanks!
1
by: BigAbility | last post by:
there is a execution file with some parameter which is title property . this file is a windows form file and also exe file . Not DLL file. i'd like to execute it another program. when another...
6
by: hecsan07 | last post by:
I am writing some code that passes two parameters to a store procedure. One of the parameters is an output parameter. I am querying the DB using the input value and returning a field from the...
8
by: Paul | last post by:
I have looked and looked for this info. All the I/O examples I've found either explicity use a file name or use the OpenFileDialog. When you drag a MS Word document over MS Word, it launches and...
3
by: mrsmith | last post by:
I'm trying to do a file load with this statement: LOAD FROM "/directory/datafile.txt" OF ASC MODIFIED BY NULLINDCHAR=Y METHOD L (1 8, 13 20, 28 30, 39 89) NULL INDICATORS (4, 7, 8,0) INSERT...
3
by: =?Utf-8?B?S3VsZGVlcCBWaWpheWt1bWFy?= | last post by:
Language: C#.NET 2.0 Technology: ASP.NET 2.0 Database: Oracle 10g Hi All, Could any one of you please suggest the BEST method to: 1. Fetch data from a very large .csv file (around 8 MB) and...
2
by: Patrick Dreyer | last post by:
Hi, I'm struggling getting a cmdlet with parameter sets working. I'd like to support three different "flavors" for calling my cmdlet Run-SSHCmd: 1) run-sshcmd Command ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
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...
0
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...
0
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,...

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.