使用参数启动 gammu



我想使用 gammu 发送带有地址和消息的文本消息,但我对gammu参数有问题。如果我只启动它运行的程序(string cmd1 = "c:\G133\bin\gammu.exe ";)。添加参数后,它给出了以下失败:

System.ComponentModel.Win32Exception'发生在系统中.dll
其它信息:系统找不到指定的文件:

法典:

string[] sms = File.ReadAllLines(@"C:\temp\test.txt");
string address = sms[0];
string message = sms[1];
string cmd1 = @"C:G133bingammu.exe --sendsms TEXT" + " " +  
    """ + address + "" -text " + " " + """ + message + """;
System.Diagnostics.Process.Start(cmd1);

谁能帮我?提前谢谢。

输出看起来不错:

Console.WriteLine(cmd1); - result
C:G133bingammu.exe --sendsms TEXT +12121234567 -text "Hello"

您需要调用Start方法的重载,该方法采用两个参数:

  • 第一个:要运行的文件;
  • 第二个:参数

它看起来像:

string app = @"pathtoyourtargetapp";
string prms = "your parameters";
System.Diagnostics.Process.Start(app, prms);

您应该拆分应用程序和参数:

Process.Start(@"C:G133bingammu.exe", "--sendsms TEXT +12121234567 -text "Hello"");

最新更新