Batch File returns "Syntax is incorrect" -
straight point. here's batch file code:
@echo off if "%1"=="" ( echo err: @ least 2 parameters required goto exit ) if not "%1"=="list" ( if "%2"=="" ( echo err: @ least 2 parameters required goto exit ) ) :: add libraries if "%1"=="add" ( if not exist %2 ( echo err: file not found goto exit ) %%i in ("%2") ( if exist "libraries/active/%%~ni.jar" ( echo err: file exists goto exit ) ) %%i in ("%2") ( if exist "libraries/inactive/%%~ni.jar" ( echo err: file exists goto exit ) ) %%i in ("%2") ( copy "%2" "libraries/active/%%~ni.jar" goto exit ) ) :: remove libraries if "%1"=="remove" ( cd libraries/active/ del %2.jar cd ../inactive/ del %2.jar cd ../../ goto exit ) if "%1"=="activate" ( if not exist "libraries/inactive/%2.jar" ( echo err: file active or not exist goto exit ) cd libraries/inactive move "%2.jar" "../%2.jar" cd ../ move "%2.jar" "active/%2.jar" cd ../ goto exit ) if "%1"=="deactivate" ( if not exist "libraries/active/%2.jar" ( echo err: file inactive or not exist goto exit ) cd libraries/active move "%2.jar" "../%2.jar" cd ../ move "%2.jar" "inactive/%2.jar" cd ../ goto exit ) if "%1"=="list" ( cd libraries/active echo. echo active libraries: echo. dir /b cd ../ cd inactive echo. echo inactive libraries echo. cd ../../ goto exit ) :exit
, when run lib list (lib name of batch file, list %1), returns "syntaxis incorrect". i've tried troubleshoot, couldn't find anything. here's file structure:
- lib (batch file)
- libraries
- active
- .jar files
- inactive
- .jar files
- active
Comments
Post a Comment