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
aasaif00Asked:
Who is Participating?
 
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
 
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
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.