Did You Know…?

Today’s blog post will be pretty short and filed under, “Did you know..?”, because, no, I did not know.

Say you have a DOS batch script that runs a MaxL script. To perform some error checking, you check to see if the stderr file file is greater than 0 KB. If so, then do something awesome with the error handling, otherwise, exit the script without incidence. I was pulling out my hair as to why the following would not work (using Sample.Basic as an example):

SectionWontRun

Why oh why oh why oh why oh why.

I tried adding a pause at the end of the StartMaxL line with a line to echo the errorlevel to see if the script even registered below the MaxL line.

errorlevel

Nope – no errorlevel or pause in the script.

Now, I don’t know what made me think of doing this, but I decided to change “StartMaxL” to “essmsh.exe” to call the shell.

essmsh

The script now returned an errorlevel code and paused. HUH. I then removed the errorlevel and pause lines and ran the script and the error checking section now worked!

I asked my colleague if he knew that essmsh.exe worked but StartMaxL did not. He said he did know, and added that if you put “call” in front of “StartMaxL”, you will be able to run code below the MaxL line (ie: call StartMaxL).

Tis true, you learn something new every day.

3 comments

  1. Automation geek here… I did know! The difference is that batch files and executables are handled differently! essmsh.exe is a typical executable, startMaxl is a batch file – these have different calling/return semantics in windows batch/command scripts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s