Page 1 of 1

Change the influence of one batch file when other one is running

Posted: 25 Jun 2018 04:24
by uglyninja
I have two batch files. One.bat, and two.bat.
One.bat:

Code: Select all

@echo off
set/p a="> "
echo %a%
pause
exit
:secretlabel
echo Secret
pause
exit
Right now (for example) one.bat is running, waiting for my input.

What i want to do is, when now i open two.bat, it will open secretlabel.

You say - you could do that easily by scanning if two.bat is running and then go to secretlabel

But.

The thing is, i don't wanna hardcode any stuff into one.bat. Which means - i wanna pretty much "hack" one.bat and make it go to :secretlabel which would otherwise be inaccessible.

I'm pretty sure it's not possible, but if it is possible, tell me how :)

Re: Change the influence of one batch file when other one is running

Posted: 25 Jun 2018 07:13
by jeb
two.bat

Code: Select all

@echo off
call :secretLabel
exit /b

:secretLabel
one.bat
Obviously 8) , this will start :secretLabel in one.bat

You don't need to start one.bat before

Re: Change the influence of one batch file when other one is running

Posted: 26 Jun 2018 07:29
by uglyninja
Yup, i know of that way.
But i want one.bat to be running, and then when i open two.bat it should do it.

No way?

Re: Change the influence of one batch file when other one is running

Posted: 26 Jun 2018 14:14
by pieh-ejdsch
Hello
To communicate from one to two you can use waitfor.
Otherwise open a writing handle from set /p into your one - in two test this writing handle also into one, if this doesn't success then goto yourLabel.
Phil