Link to home
Start Free TrialLog in
Avatar of maurice cristen
maurice cristen

asked on

Need help for:Use this special command to stop the application

Someone can help me to create a .bat file to stop AlwaysUP.exe application but only when i receive this message: ''Finished.''
thank you
Avatar of NVIT
NVIT
Flag of United States of America image

How is the message presented to you? A dialog? A file? What?
Avatar of maurice cristen
maurice cristen

ASKER

Is persented like this, first i receive a Output.txt file and this Line, so when finds this Line i want to stop

Discovered credentials on...
Make a .bat file of this.
- Adjust the value of FNLog to the actual location of output.txt:
Note: I don't know if this is ok with you but, the last line deletes output.txt. You can adjust/remove it if you like.

set FNLog=c:\output.txt
if exist "%FNLog%" (
  find "Finished" "%FNLog%"
  if !errorlevel! 0 taskkill /im AlwaysUP.exe
  del /q "%FNLog%"
)

Open in new window

not working...
Help me out, would you?

What errors do you get? Please copy and paste them here.
Here is a revised version:

SetLocal EnableDelayedExpansion
set FNLog=c:\local\output.txt
if exist "%FNLog%" (
  find "Finished" "%FNLog%"
  if !errorlevel! equ 0 taskkill /f /im AlwaysUP.exe /t
  ECHO del /q "%FNLog%"
)

Open in new window

Look,i find this on AlwaysUP site:https://www.coretechnologies.com/products/AlwaysUp/AlwaysUp_FAQ.html#NetStartStop
First of all i want to say that AlwaysUP runs my tool in SERVICES: https://www.coretechnologies.com/WindowsServices/services-control-panel-xp.jpg

Here the solution:
------------------------
How can I start or stop my application from the command line (or a batch file)?
To stop the service and your application, use:
NET STOP "My-Tool-Name (managed by AlwaysUpService)"

Open in new window

.I test it and Really Stops my tool

Now i need to modify the script bellow to STOP Automatically and only when finds the line  FINISHED inside the Output.txt




This just kills AlwaysUP.exe when finds the word FINISHED inside the output.txt

SetLocal EnableDelayedExpansion
set FNLog=c:\local\output.txt
if exist "%FNLog%" (
  find "Finished" "%FNLog%"
  if !errorlevel! equ 0 taskkill /f /im AlwaysUP.exe /t
  ECHO del /q "%FNLog%"
)

Open in new window

Just replace the TASKKILL with NET STOP, i.e.
SetLocal EnableDelayedExpansion
set FNLog=c:\local\output.txt
if exist "%FNLog%" (
  find "Finished" "%FNLog%"
  if !errorlevel! equ 0 NET STOP "My-Tool-Name (managed by AlwaysUpService)"
  ECHO del /q "%FNLog%"
)

Open in new window

works perfect when i run manually as amdinistrator now i will try to  run inside AlwaysUP
ASKER CERTIFIED SOLUTION
Avatar of NVIT
NVIT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i think work perfect now, thank youuuuuuuuuuuuuuuuuuuuuuuuuu!
finally!!!!!!!!!
thank you very much!!!!!!goodluck in ur life
first and 2'nd bat works perfect,was my mistake, wrong path, now works perfect, thanks again
You're welcome.
I was glad to help. Good luck to you as well.