473,385 Members | 1,764 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,385 software developers and data experts.

Problem starting Process with arguments

Hi!

I'm trying to run a decryption utility (des), which needs the following
parameters:
-D-u -k "key" input.file output.file

If I run this from the command-prompt it works but when I try to run it from
my application (it's a .NET service
but I've also tried running it from a Windows Application) it doesn't work.
The output from StandardError look like the ouput, if I just type "des" in
the command-prompt (it lists
all the possible arguments).

My guess is that something is wrong with the passing of parameters... any
ideas?

Thanks,
saso

The code:
string decName = @"request.dec";

string path = @"request.out.20050222";
Process myProcess = new Process();

ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(@"C:\des.exe" );

myProcessStartInfo.UseShellExecute = false;

myProcessStartInfo.CreateNoWindow = true;

myProcessStartInfo.Arguments = "-D -u -k \"myKey\" request.out.20050222";

myProcessStartInfo.RedirectStandardError = true;

myProcess.StartInfo = myProcessStartInfo;

myProcess.Start();

myProcess.WaitForExit();

StreamReader sr = myProcess.StandardError;

MessageBox.Show(sr.ReadToEnd());
Nov 16 '05 #1
6 9861
Hi,

Post the code where you init the Process instance,

IF the des program is in a network drive you will have a problem with that.
Try to use the full path to the des.exe
Does des.exe use any environment variables? they may not be accesible from
the service

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:cv**********@planja.arnes.si...
Hi!

I'm trying to run a decryption utility (des), which needs the following
parameters:
-D-u -k "key" input.file output.file

If I run this from the command-prompt it works but when I try to run it
from my application (it's a .NET service
but I've also tried running it from a Windows Application) it doesn't
work.
The output from StandardError look like the ouput, if I just type "des" in
the command-prompt (it lists
all the possible arguments).

My guess is that something is wrong with the passing of parameters... any
ideas?

Thanks,
saso

The code:
string decName = @"request.dec";

string path = @"request.out.20050222";
Process myProcess = new Process();

ProcessStartInfo myProcessStartInfo = new
ProcessStartInfo(@"C:\des.exe" );

myProcessStartInfo.UseShellExecute = false;

myProcessStartInfo.CreateNoWindow = true;

myProcessStartInfo.Arguments = "-D -u -k \"myKey\" request.out.20050222";

myProcessStartInfo.RedirectStandardError = true;

myProcess.StartInfo = myProcessStartInfo;

myProcess.Start();

myProcess.WaitForExit();

StreamReader sr = myProcess.StandardError;

MessageBox.Show(sr.ReadToEnd());

Nov 16 '05 #2
All of the code is there...

des.exe is not on a network drive. The full path is C:\des.exe (as used in
the example below).
The program runs (because I get output from Standard Error) but I doesn't
accept parameters!

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:e8*************@TK2MSFTNGP15.phx.gbl...
Hi,

Post the code where you init the Process instance,

IF the des program is in a network drive you will have a problem with
that.
Try to use the full path to the des.exe
Does des.exe use any environment variables? they may not be accesible from
the service

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:cv**********@planja.arnes.si...
Hi!

I'm trying to run a decryption utility (des), which needs the following
parameters:
-D-u -k "key" input.file output.file

If I run this from the command-prompt it works but when I try to run it
from my application (it's a .NET service
but I've also tried running it from a Windows Application) it doesn't
work.
The output from StandardError look like the ouput, if I just type "des"
in the command-prompt (it lists
all the possible arguments).

My guess is that something is wrong with the passing of parameters... any
ideas?

Thanks,
saso

The code:
string decName = @"request.dec";

string path = @"request.out.20050222";
Process myProcess = new Process();

ProcessStartInfo myProcessStartInfo = new
ProcessStartInfo(@"C:\des.exe" );

myProcessStartInfo.UseShellExecute = false;

myProcessStartInfo.CreateNoWindow = true;

myProcessStartInfo.Arguments = "-D -u -k \"myKey\" request.out.20050222";

myProcessStartInfo.RedirectStandardError = true;

myProcess.StartInfo = myProcessStartInfo;

myProcess.Start();

myProcess.WaitForExit();

StreamReader sr = myProcess.StandardError;

MessageBox.Show(sr.ReadToEnd());


Nov 16 '05 #3
Hi Saso,

Sorry for that, I did not check below the signature , too early in the
morning probably :)

Why don't you try to use the full path name for both the source & target
files?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:cv**********@planja.arnes.si...
All of the code is there...

des.exe is not on a network drive. The full path is C:\des.exe (as used in
the example below).
The program runs (because I get output from Standard Error) but I doesn't
accept parameters!

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message news:e8*************@TK2MSFTNGP15.phx.gbl...
Hi,

Post the code where you init the Process instance,

IF the des program is in a network drive you will have a problem with
that.
Try to use the full path to the des.exe
Does des.exe use any environment variables? they may not be accesible
from the service

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:cv**********@planja.arnes.si...
Hi!

I'm trying to run a decryption utility (des), which needs the following
parameters:
-D-u -k "key" input.file output.file

If I run this from the command-prompt it works but when I try to run it
from my application (it's a .NET service
but I've also tried running it from a Windows Application) it doesn't
work.
The output from StandardError look like the ouput, if I just type "des"
in the command-prompt (it lists
all the possible arguments).

My guess is that something is wrong with the passing of parameters...
any ideas?

Thanks,
saso

The code:
string decName = @"request.dec";

string path = @"request.out.20050222";
Process myProcess = new Process();

ProcessStartInfo myProcessStartInfo = new
ProcessStartInfo(@"C:\des.exe" );

myProcessStartInfo.UseShellExecute = false;

myProcessStartInfo.CreateNoWindow = true;

myProcessStartInfo.Arguments = "-D -u -k \"myKey\"
request.out.20050222";

myProcessStartInfo.RedirectStandardError = true;

myProcess.StartInfo = myProcessStartInfo;

myProcess.Start();

myProcess.WaitForExit();

StreamReader sr = myProcess.StandardError;

MessageBox.Show(sr.ReadToEnd());



Nov 16 '05 #4
it's the same...

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:eh**************@TK2MSFTNGP09.phx.gbl...
Hi Saso,

Sorry for that, I did not check below the signature , too early in the
morning probably :)

Why don't you try to use the full path name for both the source & target
files?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:cv**********@planja.arnes.si...
All of the code is there...

des.exe is not on a network drive. The full path is C:\des.exe (as used
in the example below).
The program runs (because I get output from Standard Error) but I doesn't
accept parameters!

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message news:e8*************@TK2MSFTNGP15.phx.gbl...
Hi,

Post the code where you init the Process instance,

IF the des program is in a network drive you will have a problem with
that.
Try to use the full path to the des.exe
Does des.exe use any environment variables? they may not be accesible
from the service

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:cv**********@planja.arnes.si...
Hi!

I'm trying to run a decryption utility (des), which needs the following
parameters:
-D-u -k "key" input.file output.file

If I run this from the command-prompt it works but when I try to run it
from my application (it's a .NET service
but I've also tried running it from a Windows Application) it doesn't
work.
The output from StandardError look like the ouput, if I just type "des"
in the command-prompt (it lists
all the possible arguments).

My guess is that something is wrong with the passing of parameters...
any ideas?

Thanks,
saso

The code:
string decName = @"request.dec";

string path = @"request.out.20050222";
Process myProcess = new Process();

ProcessStartInfo myProcessStartInfo = new
ProcessStartInfo(@"C:\des.exe" );

myProcessStartInfo.UseShellExecute = false;

myProcessStartInfo.CreateNoWindow = true;

myProcessStartInfo.Arguments = "-D -u -k \"myKey\"
request.out.20050222";

myProcessStartInfo.RedirectStandardError = true;

myProcess.StartInfo = myProcessStartInfo;

myProcess.Start();

myProcess.WaitForExit();

StreamReader sr = myProcess.StandardError;

MessageBox.Show(sr.ReadToEnd());



Nov 16 '05 #5
Besides... the problem is that des is not GETTING parameters not with the
parameters itself...

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:eh**************@TK2MSFTNGP09.phx.gbl...
Hi Saso,

Sorry for that, I did not check below the signature , too early in the
morning probably :)

Why don't you try to use the full path name for both the source & target
files?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:cv**********@planja.arnes.si...
All of the code is there...

des.exe is not on a network drive. The full path is C:\des.exe (as used
in the example below).
The program runs (because I get output from Standard Error) but I doesn't
accept parameters!

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message news:e8*************@TK2MSFTNGP15.phx.gbl...
Hi,

Post the code where you init the Process instance,

IF the des program is in a network drive you will have a problem with
that.
Try to use the full path to the des.exe
Does des.exe use any environment variables? they may not be accesible
from the service

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:cv**********@planja.arnes.si...
Hi!

I'm trying to run a decryption utility (des), which needs the following
parameters:
-D-u -k "key" input.file output.file

If I run this from the command-prompt it works but when I try to run it
from my application (it's a .NET service
but I've also tried running it from a Windows Application) it doesn't
work.
The output from StandardError look like the ouput, if I just type "des"
in the command-prompt (it lists
all the possible arguments).

My guess is that something is wrong with the passing of parameters...
any ideas?

Thanks,
saso

The code:
string decName = @"request.dec";

string path = @"request.out.20050222";
Process myProcess = new Process();

ProcessStartInfo myProcessStartInfo = new
ProcessStartInfo(@"C:\des.exe" );

myProcessStartInfo.UseShellExecute = false;

myProcessStartInfo.CreateNoWindow = true;

myProcessStartInfo.Arguments = "-D -u -k \"myKey\"
request.out.20050222";

myProcessStartInfo.RedirectStandardError = true;

myProcess.StartInfo = myProcessStartInfo;

myProcess.Start();

myProcess.WaitForExit();

StreamReader sr = myProcess.StandardError;

MessageBox.Show(sr.ReadToEnd());



Nov 16 '05 #6
Howdy,

In your line...

myProcessStartInfo.Arguments = "-D -u -k
\"myKey\"
request.out.20050222";
insert a whitespace before the "-D"... I pass the following to
"osql.exe" and it works. I think that the space is required to
separate the execuatable name from the arguments. Or try typing in
the command window "des.exe-D..." without a space and I think it will
fail the same.

[code:1:5fae666b70]prcDB.StartInfo.Arguments = " -E -icope.sql
-o" + m_strInstallPath + "\\copedb.log";
[/code:1:5fae666b70]

HTH,
Joe
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #7

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

Similar topics

1
by: CroDude | last post by:
Hi all! Please help me with this, I'm stuck here. I have a command line .exe file which needs a few arguments passed to do it's job. In help there's a example like this: ...
2
by: jcrouse | last post by:
I apologize for starting another thread but the old one had a weird subject line. Anyways...here is the code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As...
7
by: WALDO | last post by:
I wrote a console application that basically consumes arguments and starts other command line apps via System.Process. Let's call it XCompile for now. I wrote a Visual basic add-in that does pretty...
4
by: Phil Mc | last post by:
Say for example you have a application running on a windows 2003 server (that is on server, not from). This application needs to start child applications (must be stand alone console applications),...
2
by: Soren S. Jorgensen | last post by:
Hi, How do I see, from within my main method, in what context my assembly, containing my service program, is executed ?? I want to be able to detect if the assembly is executed by the service...
2
by: Bala Nagarajan | last post by:
Hello, I am having issues when i use the Systsem.Diagnostics.Process namespace to start a process. The problem is that i am able to succeed in starting a process (an exe) only few times in a row...
1
by: mikelujan | last post by:
Hi, Our application starts an external application using System.Diagnostics.Process class and the Start() method, as per code snippet below. This application run as a Windows service, and must...
3
by: niskin | last post by:
Hi I'm trying to use wmic (the WMI command-line) to start notepad.exe. I know that I need to type "cscript //nologo CreateProcess.vbs TestPC %windir%\system32\notepad.exe %temp%" into command...
0
by: Dominic | last post by:
Every thing work fine when I am not starting process as another user. When I am starting process as another user, the authentication is working (I can see it in my workstation security log), but...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.