[英]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
. 我正在尝试编辑自己的shell命令,以包括来自另一个应用程序(即
AxCrypt
另一个shell命令。 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". 如果右键单击文件,则转到
AxCrypt
然后选择“将文件加密为.EXE”。 Then I right-click again on the encrypted file and choose my shell command. 然后,我再次右键单击加密的文件,然后选择我的shell命令。
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. 我收到了消息框,但
AxCrypt
应用程序未运行。 any ideas on how to 关于如何的任何想法
1 . 1 。 determine if the executable i've entered is the right one for the context menu selection in windows
确定我输入的可执行文件是否是Windows中上下文菜单选择的正确选项
Run ProcessMonitor and check the path used to launch the exe is correct - otherwise you'll see whats wrong. 运行ProcessMonitor并检查用于启动exe的路径是否正确-否则,您会发现问题所在。
2 . 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)
正确运行此过程并将其输入给我单击的文件的file参数(就像我从上下文菜单中选择其菜单项一样)
string args = String.Format(@"{0}", "A File Arg");
proc.StartInfo.Arguments = args;
3 . 3 。 correctly word a message to send to AxCrypt on what i'm trying to do!
正确地写一条消息,发送给我要执行的操作给AxCrypt!
Send them a link to this SO Q & A 向他们发送此SO问答链接
I had the same problem. 我有同样的问题。 Look this:
看看这个:
System.Diagnostics.Process pProcess = new System.Diagnostics.Process();
pProcess.StartInfo.FileName = @"C:\Users\Vitor\Documents\Visual Studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe";
pProcess.StartInfo.Arguments = "olaa";
pProcess.StartInfo.UseShellExecute = false;
pProcess.StartInfo.RedirectStandardOutput = true;
pProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pProcess.StartInfo.CreateNoWindow = true;
pProcess.Start();
string output = pProcess.StandardOutput.ReadToEnd();
pProcess.WaitForExit();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.