runret - flags = 2

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
highend
Posts: 13311
Joined: 06 Feb 2011 00:33

runret - flags = 2

Post by highend »

2: Return the exit code of the process. Useful mainly for debugging.
Of the process I've used for the command param?

In that case it seems it doesn't work as it should...

If I open a cmd prompt and execute a tiny program called "Get current keyboard layout.exe"
(which doesn't print anything out by itself)
and afterwards
echo %errorlevel%
I get the returncode of that .exe, e.g.
407
or
409

These are the last 3 characters of the output of the Win32 API function GetKeyboardLayout
in this case, either with an english or with a german keyboard layout active

But trying the same from withing XY scripting, the return value is empty...

Code: Select all

$kbl = runret("R:\Get current keyboard layout.exe", <curpath>, 2);
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60541
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: runret - flags = 2

Post by admin »

The returncode is the exit code of the process "R:\Get current keyboard layout.exe".

The API is GetExitCodeProcess().

highend
Posts: 13311
Joined: 06 Feb 2011 00:33

Re: runret - flags = 2

Post by highend »

Ok, but as I said, it does not seem to work...

To try something like that yourself:
https://bintray.com/artifact/download/v ... 2-mingw.7z

Exit codes from curl:
https://ec.haxx.se/usingcurl-returns.html

Execute curl.exe from the bin folder from a command prompt with:

Code: Select all

curl.exe http://www.ab111343234.de
Output:

Code: Select all

curl: (6) Could not resolve host: www.ab111343234.de

Code: Select all

echo %errorlevel%
6

And now do it from XYplorer:

Code: Select all

text "'" . runret("""<path to curl>\curl.exe"" http://www.ab111343234.de --silent""", , 2) . "'";
The result is an empty string and not 6...
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60541
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: runret - flags = 2

Post by admin »

You forgot one comma before the flags parameter. :) This works:

Code: Select all

text "'" . runret("""<path to curl>\curl.exe"" http://www.ab111343234.de --silent""", , , 2) . "'";

highend
Posts: 13311
Joined: 06 Feb 2011 00:33

Re: runret - flags = 2

Post by highend »

Args... :blackstorm:
One of my scripts helped you out? Please donate via Paypal

Post Reply