matt
matt

Reputation: 1

Webpage Download Time and export to CSV via batch file

I am trying to set up a batch file to get webpage download time using curl command and export to CSV or text file.

I am using the following curl command:

curl http ://myurl.com -w %{time_total}\n -o NUL -s 

The command above works when using it in cmd and will provide a response ex - 0.188000.

However, when I am using the command via a batch file and try to export using the following, it does not work. Instead of .1888000, I get {time_total}.

@echo on
ECHO.
totaltimeresponse
ECHO.
SET PATH=%PATH%;C:\software\curl
ECHO.
curl http ://myurl.com -w %{time_total}\n -o NUL -s >> total-time.txt
ECHO.

This is my first time working with curl and batch files, so I am not sure what is happening. I have researched and researched, but I still don't know what wrong I have made.

Any ideas or suggestions?

Upvotes: 0

Views: 124

Answers (1)

Neto Buenrostro
Neto Buenrostro

Reputation: 1517

I don't have a Windows machine to test, but try this --should work.

@echo on
ECHO.
totaltimeresponse
ECHO.
SET PATH=%PATH%;c:\software\curl
ECHO.
curl http ://myurl.com -w %%{time_total}\n -o NUL -s >> total-time.txt
ECHO.

Upvotes: 1

Related Questions