After disabling the avgnt.exe and the networx.exe applications and re-starting them the problem happens, when starting any one of them the batch stop after starting the first and doesn't continue.
I found a way to work around this after along tries and errors and though some one might need it.
1> Create a Function.
This function will create separate batch files for every command.
2> And it must contain a main two batch file:
1) kill.bat : that contain a command to kill the cmd.exe file.
2) run.bat : that contain a command to run what batch files you will ever create and the run command for the kill.bat file.
and as an example applaied to the previous two EXE files:
Code: Select all
@echo off
:: here you will put all your commands and
:: call the function in right time then start the run.bat
:: For Example
IF "1" == "1" (
Call :Do
start "" "%temp%\run.bat"
)
:: remember to add the kill.bat in the run.bat
Exit /B
:Do
:: <<<1st application>>>
(
Echo "%programfiles%\Avira\AntiVir Desktop\avgnt.exe"
)>"%temp%\1.bat"
:: <<<2nd application>>>
(
Echo "%programfiles%\networx\networx.exe"
)>"%temp%\2.bat"
:: <<<Kill batch file>>>
(
Echo Ping localhost -n 13 >nul
Echo Taskkill /F /IM:cmd.exe
)>"%temp%\kill.bat"
:: <<<Run batchfile>>>
(
Echo start "1st EXE" "%temp%\1.bat"
Echo start "2nd EXE" "%temp%\2.bat"
Echo start "Kill Batch" "%temp%\kill.bat"
)>"%temp%\run.bat"
GOTO :EOF
The kill.bat will kill all cmd.exe processes which is used to run the original applications "avgnt.exe" and "networx.exe" so when these application starts even after the kill.bat was finished it will not be closed unless they finished from starting.
> I tried using the cmd.exe /c command but it didn't work.
> Also note that you have to use the start command to start separate CMD windows for each command that hang and not executing what ever commands after it.
> And you must use the one > to create the file so you don't have to delete them after every execution of the batch as they will be overwritten each time.
> In normal start of the windows the -n in the ping command should equal seconds but when closing all other processors and services i think it becomes milliseconds as they executing the command very fast.