473,785 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting args array from files launch through file association

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 path to the .xyz file.
this is standard stuff.

what i'd like to do is call the .xyz file via the command prompt and pass in
several input parms. like so:

myfile.xyz thing1 thing2 thing3

when this gets executed, the process engine should get an arg array (in the
Main function) that has 4 elements. the first one is the path, and the last
three are the arguments.

But, the process engine only gets the path. thing 1-3 are lost.

is there anyway i can get these items in the arg list for the Main function?

the only way i can think is to get rid of the file assiciation and you have
to call the engine exe with the path of the data file as the first arg, and
all other arguments later. I'd really rather not do this though.

thanks
Nov 17 '05 #1
1 1999
Hi John...
Sorry because I don't speak English very well but I will try to show my
suggestion:

You can create a Process object and pass in those parameters. See the
example below:

Process myProcess = new Process();
myProcess.Start Info.FileName = "myfile.xyz ";
myProcess.Start Info.CreateNoWi ndow = true;
myProcess.Start Info.Arguments = "thing1 thing2 thing3";
myProcess.Start ();

You can build the string with all arguments then you get the file path.
See more about Process class.

Test the example below (create two console applications):

Caller Program:
using System;
using System.Diagnost ics;
using System.Componen tModel;

namespace MyProcessSample {

public class MyProcess{
public static void Main(){

Process myProcess = new Process();
myProcess.Start Info.FileName = "c:\\temp\\Cons oleApplication1 0.exe";
myProcess.Start Info.Arguments = "teste1";
myProcess.Start ();

}
}
}

Called program:
using System;

namespace ConsoleApplicat ion10{
class Class1{
[STAThread]
static void Main(string[] args)
{
Console.WriteLi ne(args[0]);
Console.ReadLin e();
}
}
}
bye.

"john conwell" wrote:
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 path to the .xyz file.
this is standard stuff.

what i'd like to do is call the .xyz file via the command prompt and pass in
several input parms. like so:

myfile.xyz thing1 thing2 thing3

when this gets executed, the process engine should get an arg array (in the
Main function) that has 4 elements. the first one is the path, and the last
three are the arguments.

But, the process engine only gets the path. thing 1-3 are lost.

is there anyway i can get these items in the arg list for the Main function?

the only way i can think is to get rid of the file assiciation and you have
to call the engine exe with the path of the data file as the first arg, and
all other arguments later. I'd really rather not do this though.

thanks

Nov 17 '05 #2

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

Similar topics

2
2163
by: Anders Eriksson | last post by:
Hello! I'm a beginner at PHP and I wonder how I would go about to read a textfile into an array(hash). The textfile looks like this: A/S=age/sex? A/S/L=age/sex/location? AA=alcoholics anonymous
1
1374
by: Tim::.. | last post by:
Can someone please tell me why when ever I view a PDF file through my web application the file opens in notepad... I have checked my file association and the client machine is set to launch PDF's in Acrobat Reader 7 so that isn't the problem... Here is the part of the code for my view.aspx file... which works fine with word an excel documents but for some reason won't open PDF's... Thanks
23
7418
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these in an array. The application compiles but aborts without giving me any useful information. What I suspect is happening is infinite recursion. Each Directory object creates an array of Subdirectories each of which has an array of...
8
9025
by: =?Utf-8?B?Umlja0Q=?= | last post by:
Suddenly I find myself unable to open Winforms files in designer mode. I get the message quoted below. I can open other types of vb files like modules, classes and code behind files, but simply creating a new project and double clicking on Form1.vb gets me this message: <<< There is no editor available for 'C:\....\Form1.vb'. Make sure the application for the file type (.vb) is installed.
0
9481
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
10336
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
10155
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...
0
9953
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8978
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
7502
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
6741
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();...
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
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.