Two Scripts: START then END Application


  1. Posts : 121
    Windows 7 Ultimate 64-bit
       #1

    Two Scripts: START then END Application


    I'm running low on resources and am not wanting to upgrade, so it looks like a script to the rescue! Basically I work with Oracle 11g on my computer. Here are the 2 scripts that I'm looking to do. Please help. Thanks.

    Script 1: Start Oracle 11g
    Code:
    START Service A
    START Service B
    START Service C
    START Service D
    
    WAIT Until Service A, Service B, Service C, Service  D is STARTED
    
    'Services A-D all MUST be running BEFORE continuing
    
    Check to see if PROCESS A.exe is running
    
    'PROCESS A.exe MUST be running before continuing.  Process A will automatically execute after the said services above are started.
    
    Access Program LNK
    Here's Script #2. Note that I will close the program by itself, I just need to stop associated services and processes.

    Code:
    STOP Service A
    STOP Service B
    STOP Service C
    STOP Service D
    
    END Process.exe A
      My Computer


  2. Posts : 6,285
    Windows 10 Pro X64
       #2

    Do you really mean services or do you mean programs?

    To start services you use net start xxxxxx
    To stop services you use net stop xxxxxx

    You can use tasklist to see if a process is running tasklist | find "xxxxxx.exe" but I can't seem to get it to work right in a batch file. If I can then I believe you can also use ERRORLEVEL to determine if the process is running or not. I'll play with it some more ...
      My Computer


  3. Posts : 121
    Windows 7 Ultimate 64-bit
    Thread Starter
       #3

    Ztruker said:
    Do you really mean services or do you mean programs?

    To start services you use net start xxxxxx
    To stop services you use net stop xxxxxx

    You can use tasklist to see if a process is running tasklist | find "xxxxxx.exe" but I can't seem to get it to work right in a batch file. If I can then I believe you can also use ERRORLEVEL to determine if the process is running or not. I'll play with it some more ...
    So having that said, here is a work in progress:

    Script 1:

    Code:
    net start OracleDBConsoleorcl
    net start OracleMTSRecoveryService
    net start OracleOraDb11g_home1TNSListener
    net start OracleServiceORCL
    
    'Need code to wait until oracle.exe Process is running
    
    'Need code to access application LNK
    Script 2:

    Code:
    net stop OracleDBConsoleorcl
    net stop OracleMTSRecoveryService
    net stop OracleOraDb11g_home1TNSListener
    net stop OracleServiceORCL
    
    'Need code to END oracle.exe process
    One thing I'm curious about. Does the name of the service need quotation marks? What if the service in question had a space in it? (i.e. Plug and Play)
      My Computer


  4. Posts : 6,285
    Windows 10 Pro X64
       #4

    If there is a space, enclose it in double quotes.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 20:55.
Find Us