Problem with Exec command

Queries related to T-Plan Robot
Post Reply
herbmich

Problem with Exec command

Post by herbmich » Wed Sep 07, 2011 11:22 am

Hello,


I want to execute the following command with the "Exec":
curl.exe -v --request "GET /restart HTTP/1.1" http://192.168.0.1:8000
Wenn I execute this command in the windows command window it works well.

Wenn I execute the following command with T-Plan the curl.exe doesn't work:
Exec "curl.exe -v --request \"GET /restart HTTP/1.1\" http://192.168.0.1:8000"

I think the Problem are the " im the exec command. Have anyone the same Problems ?


best regards
Michael

rpes
User
User
Posts: 74
Joined: Thu Oct 29, 2009 5:43 pm
First Name: Robert
Last Name: Pes
Company: T-Plan

Re: Problem with Exec command

Post by rpes » Wed Sep 07, 2011 12:51 pm

What is the content of the _EXEC_ERROR (error output), _EXEC_OUTPUT (standard output) and _EXEC_VALUE (OS command exit code) variables after the Exec command gets executed? Could you please check it in the Variables table in the GUI? They could indicate where the problem is.

If either the standard or error output says something like "The system couldn't find the file specified" I would suggest to retry with full path to the curl.exe executable. It is quite possible that Windows don't expose the system path to the Java process and Robot then fails to find the application.

To verify whether Robot parses the double quotes (") correctly check the content of the _EXEC_COMMAND variable which stores the last executed command exactly as it was passed to the underlying OS.

herbmich

Re: Problem with Exec command

Post by herbmich » Thu Sep 08, 2011 6:00 am

Hello,

thanks for your fast anwser. The Problem was the wrong path. When I write the complete path to the Exec command it works.

I thought I could use the relative path. But I have to use the absolute path and then it works.

best regards,
Michael

rpes
User
User
Posts: 74
Joined: Thu Oct 29, 2009 5:43 pm
First Name: Robert
Last Name: Pes
Company: T-Plan

Re: Problem with Exec command

Post by rpes » Thu Sep 08, 2011 7:14 am

If you want to avoid hard coding of absolute paths path you can always use relative path based one of the path variables. For example, if the curl.exe file is in the parent directory of the current script the command would look like:

Code: Select all

Exec "{_SCRIPT_DIR}\..\curl.exe -v --request \"GET /restart HTTP/1.1\" http://192.168.0.1:8000"
There are a few other useful paths such as _INSTALL_DIR (Robot's install dir) or OS specific paths under the _ENV prefixed variables.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest