Here's a simple batch file I made up. Get user input to create a duplicate of every batch file with a different extension. It works, but I'm having problems with my help flag
If the user doesn't input anything, I want to display a message. But I get an error saying there is an issue with the goto method.
@ECHO off
REM Backup.bat, 10/10/2013, Josh Barber
cls
echo Choose an extension
Set /P var= Enter a file extension:
if %var% == "" goto help
copy H:\Lab5\*.bat H:\Lab5\*.%var%
goto end
:help
echo Please choose a file extension
:end
echo Process complete
pause
@ECHO off
REM Backup.bat, 10/10/2013, Josh Barber
cls
echo Choose an extension
Set /P var= Enter a file extension:
if "%var%" == "" goto help
copy H:\Lab5\*.bat H:\Lab5\*.%var%
goto end
:help
echo Please choose a file extension
goto :end
:end
echo Process complete
pause
Use quotes or if defined var
.When %var% has no value you are executing if == ""
which has wrong syntax.