Link to home
Start Free TrialLog in
Avatar of aasaif00
aasaif00

asked on

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
Avatar of aasaif00
aasaif00

ASKER

sorry misprint above how do i get the application to run those command lines before shutting down the application
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
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
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.
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
actually it also asks for the user id
ASKER CERTIFIED SOLUTION
Avatar of armoghan
armoghan
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial