Batch File - How do you detect if a program just closed?

hitokiri

Limp Gawd
Joined
Jan 1, 2001
Messages
178
I recently installed Oracle10g, and I would like to turn on processes when using it and stop processes when not in use.

I currently have two batch files. One batch file starts up all the needed processes and starts the sql plus application while another stops the processes. What I would like to do is have all the commands in a single file, so the file can stop the processes when I close the program automatically instead of having to manually start the batch. Any clues?

Here are the sample codes:
Code:
@echo on
NET START "OracleCSService"
NET START "OracleDBConsoleorcl"
NET START "OracleOraDb10g_home1iSQL*Plus"
NET START "OracleOraDb10g_home1TNSListener"
NET START "OracleServiceORCL"
start C:\oracle\product\10.1.0\db_1\BIN\sqlplusw.exe

Code:
@echo on
NET STOP "OracleCSService"
NET STOP "OracleDBConsoleorcl"
NET STOP "OracleOraDb10g_home1iSQL*Plus"
NET STOP "OracleOraDb10g_home1TNSListener"
NET STOP "OracleServiceORCL"

Thanks

- hito
 
Code:
@echo on  NET START "OracleCSService"  
NET START "OracleDBConsoleorcl"  
NET START "OracleOraDb10g_home1iSQL*Plus"  
NET START "OracleOraDb10g_home1TNSListener"  
NET START "OracleServiceORCL"  
C:\oracle\product\10.1.0\db_1\BIN\sqlplusw.exe  
NET STOP "OracleCSService"  
NET STOP "OracleDBConsoleorcl"  
NET STOP "OracleOraDb10g_home1iSQL*Plus"  
NET STOP "OracleOraDb10g_home1TNSListener"  
NET STOP "OracleServiceORCL"

Removed "start" from "start c:\oracle\prduct\......"
 
You can also use "start /wait". Don't know what the advantages of this approach are, but it works.

 
Back
Top