Execute File with long command line string

Moderator: Rathinagiri

Post Reply
User avatar
RussBaker
Posts: 51
Joined: Wed Jul 22, 2015 9:44 am

Execute File with long command line string

Post by RussBaker »

I am trying to execute a CURL command line. However it doesn't seem to do anything.
When I use "
EXECUTE FILE "Notepad.exe"
It works fine.

The PARAMETERS statement seems to break up my command line
eg: EXECTURE FILE "CURL.EXE " PARAMETERS c
Doesn't work either.

BLINKER had the SWPRUNCMD that worked perfectly to pass a variable for the command line.

The string c appears to be properly formed and works when I copy it directly to the command line.

Any Ideas?

Here is my command code

Code: Select all

c=["CURL -s -u "+alltrim(settings.text_cf_user.value)+":"+alltrim(settings.text_cf_pass.value)+" -H "+["Content-Type:application/json" -X POST -d "]+chr(91)+[{""phoneNumber"":""67076"",""message"":""Hello World!""},{""phoneNumber"":""]+tphone+["",""message"":""This is a test.  End Test""}]+chr(93)+[" "https://api.callfire.com/v2/texts"  > result.txt]+["]

EXECUTE FILE c
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Execute File with long command line string

Post by andyglezl »

Hola
A simple vista, yo creo que el problema esta en la mezcla de doble comillas ( " " ) y corchetes ( [ ] ) que estas usando
y debes separar el ejecutable de los parametros.
------------------------------------------------------------------------------------------------------------------------------------------
Hello
At first glance, I think the problem is in the mix of double quotes ( " " ) and brackets ( [ ] ) that are using.
and you must separate executable parameters.
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
RussBaker
Posts: 51
Joined: Wed Jul 22, 2015 9:44 am

Re: Execute File with long command line string

Post by RussBaker »

The double quotes are strange, but required as CURL parses Windows command line as a literal without double quotes.
That's not my problem. The problem seems to be the EXECUTE FILE doesn't pass all the command line or perhaps it tries to parse them from the string and some parameters get lost.

It's a LONG command line I understand. However, cURL and the POST site needs all of the params.

I created a batch file and ran that.

eg:
CU.BAT
Inside CU.BAT is my
cURL -s -u bla bla bla bla bla params "stuff":params:"Stuff"

And then ran
EXECUTE FILE "CU.BAT" MINIMIZE

That works. I just wish EXECUTE FILE would do it as that would be cleaner.

--Russ
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Execute File with long command line string

Post by andyglezl »

La sintaxis dice:
----------------------
The syntax says:

EXECUTE
[ OPERATION <operation> ]
[ FILE <file> ] "curl.exe"
[ PARAMETERS <parameters> ] ' -s -u bla bla bla bla bla params "stuff":params:"Stuff" '
[ DEFAULT <default> ]
[ MAXIMIZE | MINIMIZE | HIDE ]

Nota que los parametros van encerrados con comilla ( ' ' ) simple.
-----------------------------------------------------------------------------
Note that the parameters are enclosed in quotation marks ( ' ' ) simple.
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
RussBaker
Posts: 51
Joined: Wed Jul 22, 2015 9:44 am

Re: Execute File with long command line string

Post by RussBaker »

So it appears EXECUTE FILE wants the full name of the executable file.

eg: CURL wont won't
CURL.EXE works

So my command line must be

EXECUTE FILE "CURL.exe " parameters c MINIMIZE

Where c is my variable full of fun command line arguments.
eg: c=" -s -u user:password -H Content-Type:application/json -X POST -d

Now it works and doesn't pop up a command window.
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: Execute File with long command line string

Post by Carlos Britos »

Hi
Check the max length supported by the OS from the command line, maybe this is the problem.
Regards/Saludos, Carlos (bcd12a)
User avatar
RussBaker
Posts: 51
Joined: Wed Jul 22, 2015 9:44 am

Re: Execute File with long command line string

Post by RussBaker »

What I have learned is that
EXECUTE FILE
requires the full program name. In my case "CURL.EXE"
eg: EXECUTE FILE "CURL.EXE" ARGUMENTS arglist
works great

eg: EXECUTE FILE "CURL" ARGUMENTS arglist
failed to execute.

For those interested, I'm developing a program to Text message customers. It's so easy to send a text message directly and seamlessly from an HMG program.

Callfire.com and EZTexting.com both have the ability to post to their sites via cURL
It works very well, EZTexting offers 500 free texts per month which makes my application easier to sell.
User avatar
serge_girard
Posts: 3162
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Execute File with long command line string

Post by serge_girard »

Hi Russ,

I'm very interested!
Thx in advance.

Serge
There's nothing you can do that can't be done...
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Execute File with long command line string

Post by andyglezl »

Hola Russ

Solo funciona para USA y CANADA ?
---------------------------------------------
Hi Russ

Only it works for USA and Canada?
EZTexting.jpg
EZTexting.jpg (45.4 KiB) Viewed 6419 times
Andrés González López
Desde Guadalajara, Jalisco. México.
Post Reply