The current project has just completed the compilation link of all components, and it is okay to run it.
However, you have to double-click six programs (four window programs and two command line programs) each time you run the program ).
I just want to know if I can perform a batch operation once.
I first thought of the bat script, but because there are two command-line programs, and they are the same type of endless loops that do not exit, this causes the first in BAT to get stuck without running the second one.
I found some information on how to run it in the background on the Internet, all about VB.
Later, I thought Perl should be a piece of cake for this kind of feature. Find it online and find it.
1 system("Client.exe print");
The problem is the same as that of BAT.
Later, I opened the Perl help document and saw Win32: process.
Copy the example to run it.
But there are two problems:
1. Both command line programs run in a command window at the same time (same as the problem with BAT)
2. Some window programs can contain parameters but cannot run normally.
1 #!/usr/bin/perl 2 3 use Win32::Process; 4 use Win32; 5 sub ErrorReport{ 6 print Win32::FormatMessage( Win32::GetLastError() ); 7 } 8 Win32::Process::Create($ProcessObj1, "Client.exe", "", 9 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport();10 sleep(5);11 Win32::Process::Create($ProcessObj2, "GndSystem.exe", "",12 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport();13 sleep(5);14 Win32::Process::Create($ProcessObj3, "LmiInterface.exe", "",15 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport();16 sleep(5);17 Win32::Process::Create($ProcessObj4, "Monitor.exe", "",18 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport();19 sleep(5);20 #Win32::Process::Create($ProcessObj6, 'C:\Sim.exe', 'PACARS.sim', 0, NORMAL_PRIORITY_CLASS, 'C:\SecureACARS\Database')|| die ErrorReport();21 system('C:\Sim.exe PACARS.sim');
A Perl script with an empty log file is attached:
1 #!/usr/bin/perl2 3 open $Log, '> C:\GPAComm.log';4 close $Log;5 open $Log, '> C:\CoreError.log';6 close $Log;7 open $Log, '> C:\GPAError.log';8 close $Log;
http://www.tianming.me/?p=830