Batch multiple UP calls from Main Batch not works!?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Cyrex
Posts: 4
Joined: 03 Apr 2023 06:34

Batch multiple UP calls from Main Batch not works!?

#1 Post by Cyrex » 03 Apr 2023 07:00

Hello, im new and sure not a good coder in this batch Area, i try to make a small batch for my work.

my batch should call several UP batch files from a main batch file.
I've set up the basic framework, but it doesn't work as it should.
L2 works, but L5,L6 and L7 not. the structure is the same for all of the tests.

I've watched a few videos but haven't found anything that fits my problem.

If L5, L6 and L7 would at least do exactly the same as L2 and I understood the mistake, I would be very grateful if someone explained the mistake I'm making here.

Sorry for this bad English. I Know google translate is not the best.

Main Batch

Code: Select all

@echo off
color 0F
title Interface
rem ********************   M A I N   ********************
:MAIN
cls

set stunde=%time:~0,2%
set minute=%time:~3,2%
If "%stunde:~0,1%" == " " set stunde=0%stunde:~1,1%

set dt=%date:~0,2%.%date:~3,2%.%date:~6,4% %stunde%:%minute%

echo %dt%
 echo.

echo							Abteilung XXX
 echo.

echo 					Linien Aufruf
 echo.

echo				2 - Linie 2
echo				5 - Linie 5
echo				6 - Linie 6
echo				7 - Linie 7
echo				0 - Programmende
 echo.

set /p Aufruf="Aufruf:"
if %Aufruf% == 2 goto Division2
if %Aufruf% == 5 goto Division5
if %Aufruf% == 6 goto Division6
if %Aufruf% == 7 goto Division7
if %Aufruf% == 0 goto EXIT
goto MAIN

:Division2
call E:\Felix\Unterprogramme\Linie2\Linie2.bat
goto MAIN

:Division5
call E:\Felix\Unterprogramme\Linie5\Linie5.bat
goto MAIN

:Division6
call E:\Felix\Unterprogramme\Linie6\Linie6.bat
goto MAIN

:Division7
call E:\Felix\Unterprogramme\Linie7\Linie7.bat
goto MAIN




L2 (Works all)

Code: Select all

@echo off
color 0F
title Linie 2 Bearbeitung
rem ********************   M A I N   ********************
:MAIN
cls

set stunde=%time:~0,2%
set minute=%time:~3,2%
If "%stunde:~0,1%" == " " set stunde=0%stunde:~1,1%

set dt=%date:~0,2%.%date:~3,2%.%date:~6,4% %stunde%:%minute%

echo %dt%
 echo.

echo 							Maschinenauswahl
 echo.

echo				11 - OP10/1
echo				12 - OP10/2
echo				13 - OP10/3
echo				14 - OP10/4
echo				15 - OP10/5
echo				16 - OP10/6
echo				21 - OP20/1
echo				22 - OP20/2
echo				 0 - zurück
 echo.

set /p Aufruf="Aufruf:"
if %Aufruf% == 11 goto OP10/1
if %Aufruf% == 12 goto OP10/2
if %Aufruf% == 13 goto OP10/3
if %Aufruf% == 14 goto OP10/4
if %Aufruf% == 15 goto OP10/5
if %Aufruf% == 16 goto OP10/6
if %Aufruf% == 21 goto OP20/1
if %Aufruf% == 22 goto OP20/2
if %Aufruf% ==  0 goto Rücksprung
goto MAIN

:OP10/1

echo Hallo!!!! L2
pause
goto MAIN

:Rücksprung
call "" "E:\Felix\Ae_Group.bat"
L5 (Not Works)

Code: Select all

@echo off
color 0F
title Linie 5 Bearbeitung

rem ********************   M A I N   ********************
:Main
cls

set stunde=%time:~0,2%
set minute=%time:~3,2%
If "%stunde:~0,1%" == " " set stunde=0%stunde:~1,1%

set dt=%date:~0,2%.%date:~3,2%.%date:~6,4% %stunde%:%minute%

echo %dt%
 echo.
 
echo 							Maschinenauswahl
 echo.

echo				11 - OP10/1
echo				12 - OP10/2
echo				13 - OP10/3
echo				14 - OP10/4
echo				15 - OP10/5
echo				16 - OP10/6
echo				21 - OP20/1
echo				22 - OP20/2
echo				 0 - zurück
 echo.

set /p Aufruf:="Aufruf:"
if %Aufruf% == 11 goto OP10/1
if %Aufruf% == 12 goto OP10/2
if %Aufruf% == 13 goto OP10/3
if %Aufruf% == 14 goto OP10/4
if %Aufruf% == 15 goto OP10/5
if %Aufruf% == 16 goto OP10/6
if %Aufruf% == 21 goto OP20/1
if %Aufruf% == 22 goto OP20/2
if %Aufruf% ==  0 goto Rücksprung
goto MAIN

:OP10/1

echo Hallo!!!! L5
pause
goto MAIN

:Rücksprung
call "" "E:\Felix\Ae_Group.bat"
L6 (Not Works)

Code: Select all

@echo off
color 0F
title Linie 6 Bearbeitung

rem ********************   M A I N   ********************
:Main
cls

set stunde=%time:~0,2%
set minute=%time:~3,2%
If "%stunde:~0,1%" == " " set stunde=0%stunde:~1,1%

set dt=%date:~0,2%.%date:~3,2%.%date:~6,4% %stunde%:%minute%

echo %dt%
 echo.
 
echo 							Maschinenauswahl
 echo.

echo				1 - Heckert 1
echo				2 - Heckert 2
echo				3 - Heckert 3
echo				4 - Heckert 4
echo				5 - Heckert 5
echo				6 - Heckert 6
echo				7 - Heckert 7
echo				8 - Heckert 8
echo				03 - Makino 3
echo				02 - Makino 4
echo				05 - Makino 5
echo				06 - Makino 6
echo				07 - Makino 7
echo				08 - Makino 8
echo				09 - Makino 9
echo				10 - Makino 10
echo				11 - Makino 11
echo				12 - Makino 12
echo				13 - Makino 13
echo				14 - Makino 14
echo				 0 - zurück
 echo.

set /p Aufruf:="Aufruf:"
if %Aufruf% == 1 goto Heckert 1
if %Aufruf% == 2 goto Heckert 2
if %Aufruf% == 3 goto Heckert 3
if %Aufruf% == 4 goto Heckert 4
if %Aufruf% == 5 goto Heckert 5
if %Aufruf% == 6 goto Heckert 6
if %Aufruf% == 7 goto Heckert 7
if %Aufruf% == 8 goto Heckert 8
if %Aufruf% == 03 goto Makino 3
if %Aufruf% == 04 goto Makino 4
if %Aufruf% == 05 goto Makino 5
if %Aufruf% == 06 goto Makino 6
if %Aufruf% == 07 goto Makino 7
if %Aufruf% == 08 goto Makino 8
if %Aufruf% == 09 goto Makino 9
if %Aufruf% == 10 goto Makino 10
if %Aufruf% == 11 goto Makino 11
if %Aufruf% == 12 goto Makino 12
if %Aufruf% == 13 goto Makino 13
if %Aufruf% == 14 goto Makino 14
if %Aufruf% ==  0 goto Rücksprung
goto MAIN

:OP10/1
echo Hallo!!!! L6
 pause


:Rücksprung
call "" "E:\Felix\Ae_Group.bat"

L7 (Not Works)

Code: Select all

@echo off
color 0F
title Linie 7 Bearbeitung

rem ********************   M A I N   ********************
:Main
cls

set stunde=%time:~0,2%
set minute=%time:~3,2%
If "%stunde:~0,1%" == " " set stunde=0%stunde:~1,1%

set dt=%date:~0,2%.%date:~3,2%.%date:~6,4% %stunde%:%minute%

echo %dt%
 echo.
 
echo 							Maschinenauswahl
 echo.

echo				11 - OP10/1
echo				12 - OP10/2
echo				13 - OP10/3
echo				14 - OP10/4
echo				15 - OP10/5
echo				16 - OP10/6
echo				21 - OP20/1
echo				22 - OP20/27
echo				 0 - zurück
 echo.

set /p Aufruf:="Aufruf:"
if %Aufruf% == 11 goto OP10/1
if %Aufruf% == 12 goto OP10/2
if %Aufruf% == 13 goto OP10/3
if %Aufruf% == 14 goto OP10/4
if %Aufruf% == 15 goto OP10/5
if %Aufruf% == 16 goto OP10/6
if %Aufruf% == 21 goto OP20/1
if %Aufruf% == 22 goto OP20/2
if %Aufruf% ==  0 goto Rücksprung
goto MAIN

:OP10/1
echo Hallo!!!! L7
 pause
 
 :Rücksprung
call "" "E:\Felix\Ae_Group.bat"

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Batch multiple UP calls from Main Batch not works!?

#2 Post by penpen » 03 Apr 2023 16:39

I assume the error is caused by using the wrong environment variable named "Aufruf:" instead of "Aufruf", like you did in "Linie2.bat":

Code: Select all

:: Linie2.bat
set /p Aufruf="Aufruf:"
:: versus
set /p Aufruf:="Aufruf:"

penpen

Cyrex
Posts: 4
Joined: 03 Apr 2023 06:34

Re: Batch multiple UP calls from Main Batch not works!?

#3 Post by Cyrex » 04 Apr 2023 04:57

hello penpen,
Ok, thx i see that was a : in L2 on the wrong place.

My Problem is now, if i go from UP L2,L5,L6 or L7 to the Interface, the Title doesnt chance to Title Interface. Its every the last Title from where i go.
I Try Aktually to make this Problem clear.

Cyrex
Posts: 4
Joined: 03 Apr 2023 06:34

Re: Batch multiple UP calls from Main Batch not works!?

#4 Post by Cyrex » 04 Apr 2023 05:10

The Problem with the not chance Title after going back to the Interface is done.
after i jump to the mark for the bat i have set title bevore the bat is calls. so it works.

but now i have a last problem... in L6 and L7 when i press the button for the message, the message comes out, but if i press any button after the message, i come back to the main Interface...
a wrong buttom theire doenst call my Interface, so it works in L2 and L5 all perfectly.

I Check it again for know. and i hope i find the issue.
If the problem is done can one Close the Thread.

Cyrex
Posts: 4
Joined: 03 Apr 2023 06:34

Re: Batch multiple UP calls from Main Batch not works!?

#5 Post by Cyrex » 04 Apr 2023 05:42

The Issues are cleared.

sry, Im new in this Area...

My Fails are here!!!

Code: Select all

set /p Aufruf="Aufruf:"
if %Aufruf% == 11 goto OP10/1
if %Aufruf% == 12 goto OP10/2
if %Aufruf% == 13 goto OP10/3
if %Aufruf% == 14 goto OP10/4
if %Aufruf% == 15 goto OP10/5
if %Aufruf% == 16 goto OP10/6
if %Aufruf% == 21 goto OP20/1
if %Aufruf% == 22 goto OP20/2
if %Aufruf% ==  0 goto Rücksprung
goto MAIN    <<<<<< for the jump when a other buttom is clicked. that was ok.

:OP10/1
echo Hallo!!!!
 pause
goto MAIN <<<< this jump was not in the code and than is sure, after press a other buttom, the Batch goes to end
the other problem here. Not works with a Space. but im confused, in the wiki is no comment about possible SPace by Jump Marks etc.

Code: Select all

set /p Aufruf="Aufruf:"
if %Aufruf% == 1 goto Heckert 1
if %Aufruf% == 2 goto Heckert 2
if %Aufruf% == 3 goto Heckert 3
if %Aufruf% == 4 goto Heckert 4
if %Aufruf% == 5 goto Heckert 5
if %Aufruf% == 6 goto Heckert 6
if %Aufruf% == 7 goto Heckert 7
if %Aufruf% == 8 goto Heckert 8
if %Aufruf% == 03 goto Makino 3
if %Aufruf% == 04 goto Makino 4
if %Aufruf% == 05 goto Makino 5
if %Aufruf% == 06 goto Makino 6
if %Aufruf% == 07 goto Makino 7
if %Aufruf% == 08 goto Makino 8
if %Aufruf% == 09 goto Makino 9
if %Aufruf% == 10 goto Makino 10
if %Aufruf% == 11 goto Makino 11
if %Aufruf% == 12 goto Makino 12
if %Aufruf% == 13 goto Makino 13
if %Aufruf% == 14 goto Makino 14
if %Aufruf% ==  0 goto Rücksprung
goto MAIN

:Heckert 1
so is it correctly

Code: Select all

set /p Aufruf="Aufruf:"
if %Aufruf% == 1 goto Heckert1
if %Aufruf% == 2 goto Heckert2
if %Aufruf% == 3 goto Heckert3
if %Aufruf% == 4 goto Heckert4
if %Aufruf% == 5 goto Heckert5
if %Aufruf% == 6 goto Heckert6
if %Aufruf% == 7 goto Heckert7
if %Aufruf% == 8 goto Heckert8
if %Aufruf% == 03 goto Makino3
if %Aufruf% == 04 goto Makino4
if %Aufruf% == 05 goto Makino5
if %Aufruf% == 06 goto Makino6
if %Aufruf% == 07 goto Makino7
if %Aufruf% == 08 goto Makino8
if %Aufruf% == 09 goto Makino9
if %Aufruf% == 10 goto Makino10
if %Aufruf% == 11 goto Makino11
if %Aufruf% == 12 goto Makino12
if %Aufruf% == 13 goto Makino13
if %Aufruf% == 14 goto Makino14
if %Aufruf% ==  0 goto Rücksprung
goto MAIN

:Heckert1
In Echos are Space no problem, so i have mean, that is ok too by Jump Marks. but it is not.

Thanks for SUpport for my First problem. I dont know, but My Eyes have not see the Problem.

Post Reply