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
JOSHSKORN

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
Ztruker

Windows 10 Pro 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
JOSHSKORN

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
Ztruker

Windows 10 Pro X64
 
 

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

 Two Scripts: START then END Application




Thread Tools




Similar help and support threads
Thread Forum
Scheduling application to start (with GUI start)
I'm trying to get openoffice to open at a specific time. When I run it manualy: soffice.exe -calc C:\Users\Updater.ods it works fine. Open the UI, runs the macros (auto start on doc open) However, when I schedule it to run with the same command I see openoffice in the process list, but...
Performance & Maintenance
How to run PowerShell scripts easily from start menu
Hi, I have a very big problem :p I put 2 scripts in C:\Windows (pong.ps1 and pung.bat). And I added ".PS1" in the PathExt environment variable. But : When I clic Start button, and type pung, my batch script pung.bat appears in the Programs list and is selected so I just need to press to...
General Discussion
cmd.exe application error - application was unable to start correctly
cmd.exe application error - application was unable to start correctly (0x0000142). Click ok to close the application Anyone know why it happened? I got this error when I tried to restart to install an update. However, in windows update, it showed I had nothing to update. There was the little...
General Discussion
Win XP Mode - Cannot start virtual application. The application is blo
Our office has an old program that we still need to use when upgrading our PC's to Windows 7. The program will run fine if you start a windows virtual PC and install and run it. However, based on the needs of our office, I need to be able to run Windows XP mode and simply have an icon for our users...
Virtualization
Start Menu Application Take Time To Start
The problem that i am facing is that, my windows 7 search is instantaneous but when i click on the application the application takes time to load but if i run the same application from Desktop it will load immediately. This happens only one first time after bootup. does any1 else face the same...
General Discussion


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 04:49.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App