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
thank you
How is the message presented to you? A dialog? A file? What?
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...
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.
- 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%"
)
ASKER
not working...
Help me out, would you?
What errors do you get? Please copy and paste them here.
What errors do you get? Please copy and paste them here.
ASKER
??
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%"
)
ASKER
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:
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
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)"
.I test it and Really Stops my toolNow 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%"
)
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%"
)
ASKER
works perfect when i run manually as amdinistrator now i will try to run inside AlwaysUP
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i think work perfect now, thank youuuuuuuuuuuuuuuuuuuuuuuu uu!
finally!!!!!!!!!
finally!!!!!!!!!
ASKER
thank you very much!!!!!!goodluck in ur life
ASKER
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.
I was glad to help. Good luck to you as well.