Batch file generated with file::writeString does not properly execute
Posted: 18 Aug 2021 11:06
Hello,
I am having an issue with generated files from Visual Prolog...
My ultimate goal is to send http requests to fill an ElasticSearch database. The usual way would be to use cURL with a command such as
I have read about a VPcURL library, which would allow me to send requests from my prolog code, however I could not find any documentation. I then figured it would be easy to write a batch file containing the command, and then run it using the shellApi.
The problem with this approach is that the .bat file generated with writeString does not launch. When I create the same file manually it works, however when it is created with writeString it will not open, nothing happens. I also tried with basic batch commmands such as "echo test" "pause", same problem. Even by manually editing the file and renaming it or launching as adminstrator. Once generated with writeString the file seems to be compromised.
What am I missing ?
Thanks for any help, even a link to a documentation of VPcURL would be really helpful, as the writeString method is already a workaround.
Paul
I am having an issue with generated files from Visual Prolog...
My ultimate goal is to send http requests to fill an ElasticSearch database. The usual way would be to use cURL with a command such as
Code: Select all
curl -XGET "http://localhost:9200/someindex/_search" -H "Content-Type: application/json" -d"{ \"query\":{ \"match_all\":{}}}"
Code: Select all
Cmd = "curl -XPOST \"http://localhost:9200/someindex/_update/b-QvG3sBhb30C69Tqn7V\" -H 'Content-Type: application/json' -d 'my-update-script'",
file::writeString("path\\to\\test.bat", Cmd),
shell_api::shellExecute(nullHandle, "open", "path\\to\\test.bat", "", "", 1)
What am I missing ?
Thanks for any help, even a link to a documentation of VPcURL would be really helpful, as the writeString method is already a workaround.
Paul