• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

Running command lines from a console application in .net

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
aasaif00
Asked:
aasaif00
  • 4
  • 2
  • 2
1 Solution
 
aasaif00Author Commented:
sorry misprint above how do i get the application to run those command lines before shutting down the application
0
 
Razzie_Commented:
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
 
aasaif00Author Commented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Razzie_Commented:
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
 
aasaif00Author Commented:
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
 
aasaif00Author Commented:
actually it also asks for the user id
0
 
armoghanCommented:
0
 
armoghanCommented:
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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now