Showing results for 
Search instead for 
Do you mean 

Using environment variables to locate executables in batch scripts

by Technical Evangelist on ‎02-12-2016 09:32 AM - edited on ‎03-21-2016 03:46 PM by Anonymous (379 Views)


I have some DOS batch scripts that run modeler.exe which executes an .mdl. The DOS batch script has to specify the path where modeler.exe resides.  We have 32-bit and 64-bit computers with different versions of ERDAS, so the path is different on each PC. I'd like to use a system/environment variable in my scripts that contains the path to the modeler.exe.


Do you know how to automatically determine where modeler.exe resides on a computer?  How is the IMAGINE_HOME variable set and how do I get it's value (using a DOS script)?


We don't not recommend to setup an "IMAGINE_HOME" environment variable for your system. If you point this variable to v9.3 root folder, then your IMAGINE 2011 will not work.


For example, IMAGINE v2010 will save its IMAGINE_HOME on registry "HKEY_LOCAL_MACHINE\SOFTWARE\ERDAS\Imagine\10\ImagineHome"


You can try some thing like this: C:\Documents and Settings\xxx>reg query "HKEY_LOCAL_MACHINE\SOFTWARE\ERDAS\Imagine\10" /v "ImagineHome"

this will return the IMAGINE home path to you, then you can use this to locate the modeler.exe


If permission is not granted to run reg query, you can search from the IMAGINE software root directory to avoid full drive searches.


If IMAGINE is installed on default location, then

[Windows 32bit XP] C:\Program Files\ERDAS\ERDAS Desktop 2010

[Windows 64bit XP] C:\ERDAS\ERDAS Desktop 2010


You can use the following dos command to find out the OS version: >systeminfo | find "OS Name"