0

亲爱的,我尝试使用 gnikii 发送多行短信,但失败了

 Dim xCmd As String
    xCmd = "cmd.exe /c echo " & txtBody.Text & " | c:\sms\gnokii.exe --sendsms 0771234567 2> test.txt"
    Shell(xCmd)

请帮我

4

1 回答 1

0

您可以在 vbCrLf 上拆分文本并在前面添加 echo 以便最终使用此 cmdline

cmd.exe /c lineOne echo line2 | c:\sms\gnokii.exe --sendsms 0771234567 2> test.txt

明智的代码你可以这样做:

    Dim sString As String 
    Dim aLines As String()
    Dim xCmd As String

    sString = "lineOne" & vbCrLf & "line2"
    aLines = sString.Split(vbCrLf)
    sString = Join(aLines," echo")

    xCmd = "cmd.exe /c " & sString & " | c:\sms\gnokii.exe --sendsms 0771234567 2> test.txt"
    Shell(xCmd)
于 2013-12-18T08:15:52.030 回答