Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

Not getting the returned value from a bat file executed from GE plugin



I have a bat file that checks to see if a file exists or not. It returns a 1 if it is found and a 0 if doesn't.

Here is the bat file.

@echo off

title file

IF EXIST "Y:\*.trg" (


) ELSE (



It works when I run it in a CMD and returns a 1, however, I don't get the values returned successfully from the GE Plugin. I'm not sure what I am missing. I know I have something incorrectly configured.

I really appreciate any help, thanks



Dynatrace Pro
Dynatrace Pro

Hi Tom,

I don't think that "ECHO" does actually "return" anything. Could you try with "EXIT 1" or "EXIT 0" instead or additionally?

Hello Peter,

Thanks for taking a look at this, I tried replacing ECHO with EXIT and unfortunately, when ran in CMD, it just closes the CMD windows, when ran in GE Plugin, I get the same results, except the stream is empty.



Yes, that's what the echo does, putting a "1" on the output stream, but it's not actually returning a value, that's what the exit should do (which, on the other hand, wouldn't print anything, so you might want to do both).

On the other hand, traditionally a "0" exit value should indicate success and a "1" exit value error, so you may want to switch that also.

However, I can't explain why the plugin doesn't capture the exit value, sorry.

Could you post a screenshot of the "Edit Returned Measures" link?


Thanks for everyones help, below is a screenshot of the Returned Measures, I wasn't sure what to put in it. Also, sorry, not sure how to do this, but how do I do an EXIT and an ECHO in my bat?

Hi Tom,

I'll try that out myself when I have a moment and let you know. You can just write an ECHO in one line and an EXIT in the other, that should give you both, the std out output and the return value. Best regards,



Hello everyone,

Thanks for the help, I found a much easier way to achieve what I was attempting to do. I am using powershell and the executionSuccess measure. If a file is found, I receive a 1, if not, a 0.

powershell - command Get-ChildItem (FullPath)\*.dat

This did the tricks, thanks again,



Hey guys,

Thanks again for all the help, I am getting closer, I can get a returnCode of 0 when the file doesn't exists, and a 1 if I change the bat file to EXIT with a 1 if the file doesn't exit. So I think it might be an issue with the Bat file where I have:

IF EXIST "Y:\.dat"

Y: is a mapped drive, and I need to do a scheduled check on if any .dat files exist. Perhaps I need a wild card or something. Not very familiar with BAT file creation.

Thanks again,