Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to run something from within VB.NET that just sends a command to the dos prompt command line. I know there is alot of code out there to pass in an .exe filename and have it run but that isn't what I need. I need to run a program that accepts a filename as a param.

So I basically just need to send the following to the dos prompt:

 

fme base.fme

 

fme is the program and that is the way it is called from the command line so I just need to send that statement. Also the file base.fme is in a working directory so I need to specify that as well somehow but I think I can do that like so:

 

fme c:\base.fme

 

Can this be done?

Wanna-Be C# Superstar
Posted

Do you want to read the commandline used when starting your application, or do you want to start another application with a specific commandline?

 

In the first case you might try reading

http://www.xtremedotnettalk.com/showthread.php?t=81222&highlight=commandline

 

In the second case, the MS documentation about System.Diagnostics.Process.Start(string, string) method:

 

extract from Microsoft MSDN

Process.Start Method (String, String)

Starts a process resource by specifying the name of an application and a set of command line arguments, and associates the resource with a new Process component.

 

Visual Basic

Overloads Public Shared Function Start( _

ByVal fileName As String, _

ByVal arguments As String _

) As Process

 

C#

public static Process Start(

string fileName,

string arguments

);

 

Parameters

fileName

The name of an application file to run in the process.

arguments

Command line arguments to pass when starting the process.

Nothing is as illusive as 'the last bug'.
Posted

Don't think that answers my issue. I don't want to run an .exe. My program is not an .exe. It is run by issuing the command fme at the dos prompt followed by a file name. If I use the process model then I will be running the file as an .exe and this has unintended consequences because it will run under a different program so :

 

fme base.fme

 

is completely different from

 

Process.Start Method ("base.fme")

 

because the latter will run as an exe while the former will run based on what is in the PATH variable for fme.

 

All I need is to be able to replicate the process of opening a dos prompt and typing two words and hitting enter.

Wanna-Be C# Superstar
Posted
There is an exe called fme.exe at the path specified in the environ path variable. But it appears that the program functions in different ways depending on how you call it. If I try to use the process.start method I get the GUI version of the program which is not what I want.
Wanna-Be C# Superstar
Posted
Nope. That gets me the GUI with my mapping file loaded into it and then I have to manually fire it off. It's just not the same as typing it in at the prompt. Wish there was I was I could just emit the text I want to the prompt and then simulate hitting the Enter key.
Wanna-Be C# Superstar
Posted
Are you sure that the commandline "fme base.frme" runs fme.exe, and not some fme.bat or even old DOS style fme.com program? That might be the trick how they see that they are started from the command line....
Nothing is as illusive as 'the last bug'.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...