Saved Bookmarks
| 1. |
Solve : Can I execute commands when the window closes?? |
|
Answer» I have been programming a chatroom for me and my friends on BATCH. You can have an exit script that it can run in the background, but this would have to remain open while the chat service is running I'm sorry, I don't understand what you mean. I don't know how to run it in the background. The batch itself is called Chatroom.bat and the LOG is called ChatLog.txt, if this helps at all.If you were to MAKE chatroom.bat into a .exe program, then you would use Code: [Select]@echo off :loop tasklist | find "CHAT.exe" if %errorlevel% == 0 goto loop echo ^/^/ %username% has left. >>ChatLog.txt REM this is where you resend your chatlog. exit /b Otherwise, you would have to make a logout option/command within the chat system. Code: [Select]REM say we are using %input% as our veriable that would get entered into chatlog.txt if "%input%"=="$logout" ( echo ^/^/ %username% has left. >>ChatLog.txt REM this is where you resend your chatlog. ) this would not happen if they were to just x out of the program. |
|