Modifying a Batch Script

Batch installation scripts that are created with the Batch Tool Wizard in MIP ordinarily do not need any modification. However, if the script needs to run without user interaction or requires customization, the system administrator can modify the script to perform pre- and post-installation tasks.

Procedure

  1. If you want the installation to proceed without prompting the user for license path or WDIR path information, create a registrator.ini file and define these values to automate this part of the registration process.

    For example:

    [defaults]
    MGLS_LICENSE_FILE=1717@licenseserver
    WDIR=C:\my_WDIR
    WDIR_PADSVX.2.6=C:\WDIR\PADSVX.2.6

    For more information, refer to “CFGR_INI”.

  2. Modify the batch file that MIP created (myBatchFile.bat, for example) within the pre-install or post-install areas.
    Tip

    Be very careful, however, if you modify any commands outside of those areas. You could inadvertently modify code and cause the installation to fail.

    1. Using a text editor such as Notepad, open the myBatchFile.bat file.
    2. Add any pre-installation commands (programs or environment settings that you want to run before the installation starts) between these lines in the batch script file:
      REM***ADD YOUR OWN PRE INSTALL COMMANDS BELOW HERE***
      
      REM***ADD YOUR OWN PRE INSTALL COMMANDS ABOVE HERE***

      The following is an example of a pre-installation command that creates CFGR_INI as a system variable and assigns a value to the variable. The command then creates a folder and copies the registrator.ini file into the folder. Because this occurs pre-installation, the installation program recognizes the variable at runtime.

      REM *** ADD YOUR OWN PRE INSTALL COMMANDS BELOW HERE ***
      :: If you want to run any pre-install scripts, this is where they go. 
      :: Create a temporary registry value for the configurator.ini file.
      set SYSENVKEY="HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
      set CFGR_INI=C:\MentorGraphics\registrator.ini
      REG ADD %SYSENVKEY% /v CFGR_INI /d "%CFGR_INI%" /f
      :: Copy a pre-configured registrator.ini.
      mkdir C:\MentorGraphics
      call copy Z:\mgc_configs\registrator.ini C:\MentorGraphics\registrator.ini
      REM *** ADD YOUR OWN PRE INSTALL COMMANDS ABOVE HERE ***
    3. Add any post-installation commands (programs or environment settings that you want to run after the installation completes) between these lines in the batch script file:
      REM***ADD YOUR OWN POST INSTALL COMMANDS BELOW HERE***
      REM***ADD YOUR OWN POST INSTALL COMMANDS ABOVE HERE***

      The following is an example of a post-installation command that removes the CFGR_INI environment variable from the system environment and removes a drive mapping.

      REM *** ADD YOUR OWN POST INSTALL COMMANDS BELOW HERE ***
      :: Here is where you can remove the drive mapping if you want.
      net use Z: /DELETE
      :: Delete a SYSTEM environment variable. 
      REG DELETE %SYSENVKEY% /v CFGR_INI /f
      REM *** ADD YOUR OWN POST INSTALL COMMANDS ABOVE HERE ***