im try to send sms using gnokii sms library (http://gnokii.org/) with vb .net,im created a seperate bat file and call that bat file from my vb.net code
this is my vb code
Dim process As New System.Diagnostics.Process
Dim startInfo As New ProcessStartInfo(AppDomain.CurrentDomain.BaseDirectory & "sms.bat")
process.StartInfo = startInfo
process.StartInfo.Arguments = txtBody.Text'text typed in text box
this is my bat file
@echo off
echo Begin Transaction
echo "message body" | c:\sms\gnokii.exe --sendsms 0771234567 'this is mobile no
pause
my problem is i want to pass two parameters to message body and mobile no without hard code them
message body consisted with spaces and multilines and mobile no cosistend only single line without spaces
how can i Achieve in bat file
please help
First you should test, if the
gnokii.exe
accepts multiline texts via a pipe.Simply create a multiline text file and try it with
If this works it should be also possible to send it from a batch file and add linefeeds into the text.
EnableDelayedExpansion should be used when linefeed characters are used.
There exists also solutions to use it with percent expansion, but that is much more complicated.
Explain how dos-batch newline variable hack works
To use this with parameters like in your comment, you need to format the message in VB.
So when you want to send a text like
You need to send to the batch
And your batch should look like
A second solution, when this doesn't work.
Create a temporary file and use redirection