ikathegreat ikathegreat - 3 months ago 10
Bash Question

run shell command for third party application, pass file arguements

I'm trying to edit my own shell command to include another shell command from another application, namely

AxCrypt
. In a sense I'm trying to merge two context menu actions into one. If I right-click on a file, I go to
AxCrypt
and choose "Encrypt file to .EXE". Then I right-click again on the encrypted file and choose my shell command.

The reason I'm being so specific is someone may have something like this already. I have added this:

try
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = true;
proc.StartInfo.FileName = @"C:\Program Files\Axantum\AxCrypt\AxCrypt.exe";
proc.Start();
MessageBox.Show("AxCrypt run");
}...


I get my messagebox, but the
AxCrypt
application doesn't run. any ideas on how to


  1. determine if the executable i've entered is the right one for the context menu selection in windows

  2. correctly run this process and feed it the file argument for the file that i clicked on (as if i had chosen their menu item from the context menu)

  3. correctly word a message to send to AxCrypt on what i'm trying to do!


Answer

1. determine if the executable i've entered is the right one for the context menu selection in windows

Run ProcessMonitor and check the path used to launch the exe is correct - otherwise you'll see whats wrong.

2. correctly run this process and feed it the file argument for the file that i clicked on (as if i had chosen their menu item from the context menu)

string args = String.Format(@"{0}", "A File Arg");
proc.StartInfo.Arguments = args;

3. correctly word a message to send to AxCrypt on what i'm trying to do!

Send them a link to this SO Q & A