简体   繁体   English

为第三方应用程序运行shell命令,传递文件争论

[英]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. determine if the executable i've entered is the right one for the context menu selection in windows 确定我输入的可执行文件是否是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) 正确运行此过程并将其输入给我单击的文件的file参数(就像我从上下文菜单中选择其菜单项一样)
  3. correctly word a message to send to AxCrypt on what i'm trying to do! 正确地写一条消息,发送给我要执行的操作给AxCrypt!

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.

相关问题 无法使用第三方应用程序将 MailItem 另存为 msg 文件 - Unable to SaveAs MailItem as msg file using third party application 新创建的.text文件中的数据对第三方应用程序不可读 - Data from newly created .text file is not readable to third party application 如何安装第三方应用程序 - How to install a third party application UWP应用程序第三方SDK - UWP Application Third party SDK 如何在.Net Core 中使用不同的第三方记录器登录到文件? 第三方记录器可能会在应用程序启动时动态更改 - How to log to a file using different third party logger in .Net Core? Third party logger may change dynamically when application starts 试图在Linux上的ARM上以单声道运行第三方.NET应用程序-卡西尼号源代码兼容吗? - Trying to run third party .NET application in mono on an ARM in linux - Cassini source code compatibility? 传递第三方对象作为命令参数 - Passing a third party object as Command Parameter 第三方应用程序的空闲会话到期 - Third party Application's Idle Session expiry 在WCF第三方应用程序中获取绑定和URI - Getting the Binding and URI in a WCF third party application 将文本框放在Flash第三方应用程序上 - Focus textbox on flash third party application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM