Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Running command lines from a console application in .net

Posted on 2004-10-26
10
Medium Priority
?
169 Views
Last Modified: 2010-04-15
Hello
I am new to  writing console applications in .net.  I have written a application that reads in filenames and combines them into one.  That i have working properly
                  

now I need to encrypt that file using pgp command lines, I know the command lines
however I do i get the application to run those command lines before shutting down the application
0
Comment
Question by:aasaif00
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
10 Comments
 

Author Comment

by:aasaif00
ID: 12412014
sorry misprint above how do i get the application to run those command lines before shutting down the application
0
 
LVL 8

Expert Comment

by:Razzie_
ID: 12412170
You can start pgp using

System.Diagnostics.Process p = Process.Start(@"C:\pgp.exe", "command1 command2 command3");

where C:\pgp.exe is your path to the pgp program and command1 to 3 are the command parameters you'd normally give them.

HTH,

Razzie
0
 

Author Comment

by:aasaif00
ID: 12412837
there are mutiple sequential commands i have to run

pgp.exe

pgp -e filename

yes

however i couldnot pass all those parameters into the function u showed me am i missing something
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:Razzie_
ID: 12413306
System.Diagnostics.Process p = Process.Start(@"C:\pgp.exe", "-e " + filename);

where filename is the name of the variable (you could hardcode that name in the command of course "-e somefile" etc.
0
 

Author Comment

by:aasaif00
ID: 12413719
sorry im still confused because i need to add more parameters then that

example on the first prompt i must type in the executible
pgp

next prompt i have to type in a command
C:PGP> pgp -e filename

the next prompt will ask me if im sure i want to encrypt this i type
yes

is there any way to program this if i already know all the answers
0
 

Author Comment

by:aasaif00
ID: 12414979
actually it also asks for the user id
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12419753
0
 
LVL 18

Accepted Solution

by:
armoghan earned 1000 total points
ID: 12419789
When you get the process you can send keys to it as well
see the following PAQ as well for sending keys to an appliaction
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20895124.html
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question