Creating a batch file, for simple javac and java command execution

前端 未结 11 2577
终归单人心
终归单人心 2021-02-15 14:18

It is a really simple thing but I cannot get my head around it. I have looked at plenty of StackOverFlow post and as well as on internet.

My goal is to create a .bat whi

11条回答
  •  生来不讨喜
    2021-02-15 14:35

    @author MADMILK
    @echo off
    :getback1
    set /p jump1=Do you want to compile? Write yes/no : 
    if %jump1% = yes
    goto loop
    if %jump1% = no
    goto getback2
    :: Important part here
    :getback2
    set /p jump2=Do you want to run a java program? Write yes/no : 
    if %jump2% = yes
    goto loop2
    if %jump2% = no
    goto getback1
    :: Make a folder anywhere what you want to use for scripts, for example i make one.
    cd desktop
    :: This is the folder where is gonna be your script(s)
    mkdir My Scripts
    cd My Scripts
    title Java runner/compiler
    echo REMEMBER! LOWER CASES AND UPPER CASES ARE IMPORTANT!
    :loop
    echo This is the java compiler program.
    set /p jcVal=What java program do you want to compile? : 
    javac %jcVal%
    :loop2
    echo This is the java code runner program.
    set /p javaVal=What java program do you want to run? : 
    java %javaVal%
    pause >nul
    echo Press NOTHING to leave
    

提交回复
热议问题