|
Answer» My APC Backup UPS 400 will be used to send a "space" command to the running Dos program. However, since APC doesn't supply any info, I am looking for a batch file that will work. The file is run from the APC software when a power incident occurs. Any suggestions would be appreciated. By space command I'm guessing you mean the space character. Unless this running program is waiting for input, I'm not aware of any way to interrupt a program to force feed it data.
If during the execution of this program, it eventually requests data, it is possible to put the input on the stack where the program will look first for input. This has to be done when the program is launched.
Code: [Select]echo. | APCprogram
Not much to look at, but we really need more info about this DOS program. The program runs a small CNC Mill. It accepts input from several keys including the space bar which pauses the program. Without the UPS when a power disruption occurs, the system just stops. My hope is that with a UPS, we can initiate a Pause until power is restored, or at least stop the program and get it restored when power resumes. This is what APC says:
In order for command files to be launched properly from PowerChute Network Shutdown, it is critical that you use the correct syntax. Since these command files are launched by services, they require syntax that is not required by a command when launched from a command line.
If the command file includes statements to run executable programs (.exe), a DOS command called @START MUST be used in these statements. The @START command uses these syntax rules:
- The full path name of executable program is required - Path names that include spaces must be enclosed in quotes - A double quote must precede the quoted path name - If the executable requires arguments, the arguments must be placed outside the quotes
Below are some examples of proper syntax, using APC shutdown utilities as the executables:
Example 1: Executable program with spaces in the full path name. The empty double-quote is required because of the way the @START command works. The @START command opens a window in which to run the executable. The user can assign a name to this window; the name must be placed in quotes after the @START command. :
rem Microsoft Internet Information Server shutdown utility: @START "" "C:\Program Files\APC\PowerChute Network Shutdown\Agent\Shutdown Utilities\shutiis"
Example 2: Executable program requiring arguments. Notice that the arguments are outside of the quotes:
rem Microsoft BackOffice shutdown utility: @START "" "C:\Program Files\APC\PowerChute Network Shutdown\Agent\Shutdown Utilities\shutback" SNA Exchange SMS SQL
Example 3: In the latest version of PCNS, application shutdown MAY look a little different:
To use the shutdown DLL utilities, do the following:
Include the following line (using the full path name) in a command file with any other commands that you want PowerChute Network Shutdown to execute before shutting down the operating system. @START /D"installation dir\Shutdown utilities" appshut DLL name So, for example to shut down Microsoft IIS from the default installation directory:
@START /D"C:\Program Files\PowerChute\Shutdown utilities" appshut ShutdownIIS.dll
Example 4: Executable program with no spaces in the full path name. Notice that no quotes are required:
rem Oracle shutdown utility: @START C:\APC\Oracle\PWRFAIL.BAT From what I've read of your post, the APC utilities are triggered during a power outage to ensure the smooth shutdown of various major subsystems running on the local machine.
What I didn't see was any of these utilities sending data or keystrokes to these subsystems. I'm guessing the APC utilities QUIESCE each program using the Windows API.
More about this program that runs the CNC Mill. Can you not include the program in the list of programs that APC shuts down? As for pausing the program, I'm not sure how to send a space variable thru a batch file as most times a variable with a value of space is INTERPRETED as undefined.
|