Specifying Files in the Command-line

When a Windows version of LINGO starts up, it checks the command-line for the presence of the following three commands:

Command

Action at Runtime

-Tfilename

LINGO executes a File|Take Commands command on the script file filename. If an AUTOLG.DAT file is present in LINGO's working directory, it will be queued for execution before filename.

-Ofilename

LINGO performs a File|Open command on filename, reading the file into a standard window.

-Lfilename

LINGO executes a File|Log Output command, causing all output that would normally have been sent to the command window to be routed to filename.

As an example, suppose we have the following command script:

! Input a small model

MODEL:

MAX = 20 * X + 30 * Y;

X <= 50;

Y  <= 60;

X + 2 * Y <= 120;

END

! Terse output mode

SET TERSEO 1

! Solve the model

GO

! Open a file

DIVERT SOLU.TXT

! Send solution to the file

SOLUTION

! Close solution file

RVRT

! Quit LINGO

QUIT

Command Script: TEST.LTF

This script file inputs a small model, solves it, and then writes a solution report out to the file SOLU.TXT. Let's suppose the script file is titled TEST.LTF. We can instruct LINGO to automatically execute this file by adding the following command to LINGO's command-line: -tTEST.LTF. To do this under Windows, you will first need to create a shortcut icon for LINGO. Click the right mouse button on your desktop, and then select the New command followed by the Shortcut command. Press the Browse button and then select the LINGO application file, which is found under the name LINGO.EXE in your main LINGO directory. You should now have a LINGO shortcut icon on your desktop that looks like:

page252xp

To edit the command-line you must right click on this icon and then select the Properties command. You will then see the dialog box:

page253xp

In the Target edit box, add the command -tTEST.LTF. If you want LINGO to run without opening up a window, you can also select the Minimized option from the Run list box. Now, click the Apply button followed by the OK button.

You can now run LINGO and have it execute the script file by double clicking the shortcut icon on the desktop. Once you have done this, the solution file, SOLU.TXT, should contain:

Variable        Value          Reduced Cost

       X       50.00000          0.000000

       Y       35.00000          0.000000

 

     Row   Slack or Surplus    Dual Price

       1       2050.000          1.000000

       2       0.000000          5.000000

       3       25.00000          0.000000

       4       0.000000          15.00000

File: SOLU.TXT