I'm trying to make a batch file that will open python files, from competition, in notepadd++. Different stages have dieffrent number of tasks. It allows you to choose year and stage. Also it allows you to open them only to view. Last think it does it asks you if you would like to create missing files. I'm using exist to check if the file exist, notepad++ will automatically ask you if you want to create missing files, and I would like to avoid that.
@echo off
echo What stage?
SET /p etap=
echo What year?
SET /p rok=
echo Edit? [y/n] ::Open as read only or not.
SET /p mode=
if %mode%==y (
echo Create missing files? [y/n]
SET /p missing=
if %missing%==y (
if %etap%==3 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py
if %etap%==3 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py
if %etap%==3 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py
if %etap%==3 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z4.py
if %etap%==2 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py
if %etap%==2 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py
if %etap%==2 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py
if %etap%==1 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py
if %etap%==1 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py
if %etap%==1 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py
) else (
if exist E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py if %etap%==3 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py
if exist E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py if %etap%==3 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py
if exist E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py if %etap%==3 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py
if exist E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z4.py if %etap%==3 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z4.py
if exist E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py if %etap%==2 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py
if exist E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py if %etap%==2 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py
if exist E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py if %etap%==2 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py
if exist E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py if %etap%==1 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py
if exist E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py if %etap%==1 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py
if exist E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py if %etap%==1 start notepad++ E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py )
) else (
if %etap%==3 start notepad++ -ro -nosession E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py
if %etap%==3 start notepad++ -ro -nosession E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py
if %etap%==3 start notepad++ -ro -nosession E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py
if %etap%==3 start notepad++ -ro -nosession E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z4.py
if %etap%==2 start notepad++ -ro -nosession E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py
if %etap%==2 start notepad++ -ro -nosession E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py
if %etap%==2 start notepad++ -ro -nosession E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py
if %etap%==1 start notepad++ -ro -nosession E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z1.py
if %etap%==1 start notepad++ -ro -nosession E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z2.py
if %etap%==1 start notepad++ -ro -nosession E:\Programs\Python\Programs\Logia\%rok%_e%etap%_z3.py )
start chrome http://logia.oeiizk.waw.pl/nowa/page.php?sr=logia%rok%/%etap%etap
pause
When I run the file it asks first 3 questions and closes. I think it is because of the brackets.
::
is technically a line label, and when it's not the first thing on a line, there can be side effects. Try moving the comment to its own line.