Search code examples
windowsbatch-filecall

Why is the batch file I created not called?


I am making a game and an installer for it in batch. The game has a pause option (input 5), but it doesn't call the pause.bat file that I created with the installer.

I made a map for it with 2 submaps in it "map 1" and "map 2" the pause menu and the other menus are located in "map 1" and "map 2" has all the play files in it. I tried a lot but it didn't work.

Here is C:\.mygame\map2\play.bat

set /p Attack=Choose your attack:
if %Attack%==5 call pause.bat 
if %Attack%==1 call Attack1.bat 
if %Attack%==2 call Attack2.bat 
if %Attack%==3 call Attack3.bat 
if %Attack%==4 call Attack4.bat 
goto NoMana

And here is contents of \map1\pause.bat

:pause
cls

Solution

  • Try avoid overriding of commands when it's possible:

    if "%Attack%"=="5" call MyPause.bat
    

    Because there is a native command pause.