Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Two Scripts: START then END Application

07 Jan 2011   #1

Windows 7 Ultimate 64-bit
 
 
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 System SpecsSystem Spec
.

07 Jan 2011   #2

Windows 8 Core X64
 
 

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 System SpecsSystem Spec
07 Jan 2011   #3

Windows 7 Ultimate 64-bit
 
 

Quote   Quote: Originally Posted by Ztruker View Post
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 System SpecsSystem Spec
.


08 Jan 2011   #4

Windows 8 Core X64
 
 

If there is a space, enclose it in double quotes.
My System SpecsSystem Spec
Reply

 Two Scripts: START then END Application




Thread Tools




Our Sites

Site Links

About Us

Find 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 01:37 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33