This post is about an app I developed for this purpose. In this post, I’ll demonstrate how to create POST request on the Windows command line, or incorporate with a Batch file.
Generally, everything that can be done via the command line is useful for automation, tasks (Windows Task Scheduler), and easy integration between systems (usually old systems, even though can create an HTTP request usually can execute a batch file).
Allowing automation of HTTP request is what motivated me to create this tool. I would like to thank anyone that is considering supporting me and buying my software. It means a lot.
Download a file from the Internet using the command line
You can use cmdlinepost.exe tool to download files from the internet and save them where ever you wish.
cmdlinepost.exe /url http://www.example.com/somefile.exe /o myfile.demo
/url – specify the URL of the file you want to download. Both HTTP and HTTPS protocols are supported.
/o – specify the path for the downloaded file. If not a full path is provided, it will be saved where cmdlinepost.exe is located. If you want the file name to be determined automatically write “default” as the parameter value.
Create a raw HTTP request from the command line
cmdlinepost.exe supports raw HTTP requests. This can be done by sending a text file as a parameter for the program.
cmdlinepost.exe /i script.txt /https /o default
/i – specify the path for the script file that contains the raw HTTP request text.
/https – use this parameter to indicate that the request should be done via secure HTTP. Https is not a part of the raw HTTP request and thus should be noted separately.
An example of a raw HTTP request:
POST /invoices HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
Accept-Encoding: gzip, deflate
Of course that every header is supported like basic authentication, cookies, etc. All methods are supported as well.
Using a script file like this is the most flexible way to work with cmdlinepost.exe
Post data to an address from the command line
You can use cmdlinepost.exe to create POST requests quickly from the command line:
cmdlinepost.exe /url https://www.example.com/service /method post /payload "form data here"
/method – select which method should cmdpostline.exe use for the request. default is GET.
/payload – use this parameter to specify the payload of the request
- Initiate SOAP methods on a web service.
- POST / PATCH / DELETE (and more) requests over RESTful API
- Specify file encoding.
- Time requests
- Use basic authentication
Features to be added soon:
Support for client certificates.
I’ll update this post with a lot more that can be done with cmdlinepost.exe (and perhaps think of a better name for it 🙂 )