2016-06-10 2 views
1

작동하지 않습니다 인수 % argi % 및 % argii %. 나는 옵션 메뉴에서 다시 시작하기 위해 [b]를 누른다. 나는 똑같은 일을 다시하고 짜증나 다. 왜? 왜 처음에는 작동하지 않는가? 그리고 [b]를 눌러 다시 돌아와 args를 다시 입력하면 매번 올바르게 작동한다. 그때는 Ctrl-C를 가진 스크립트를 죽이고 그것을 다시 열면 Here I enter 1, then give the 2 variables argi and argii Press Enter, and the jar throws an error because it doesn't 'understands the arguments Then I press b to go back and take it all over again And voila! The result as expected!배치 변수 나는 다음과 같은 배치 스크립트는 한

, 그것은 다시 같은 동작을합니다 ... 처음 오류 및 :

나는 응용 프로그램을 시작 성공. 감사합니다.

+1

가능한 복제 [/F](http://stackoverflow.com/questions/13805187/how-to-set-a에 대한 루프 내부 변수를 설정하는 방법 -variable-inside-a-loop-for-f) –

답변

0

당신은 delayed expansion 필요

@echo off 
setlocal enableDelayedExpansion 
color 2f 
title "USERS MANAGEMENT IN A LAN" 
:top 
echo *************************************************************** 
echo. 
echo SELECT ACTIONS 
echo. 
echo *************************************************************** 
echo. 
echo [1] Ping the service     Params: unu 
echo [2] TBD 
echo. 
echo [e] Exit 
echo. 
echo *************************************************************** 
echo Enter the number of the website which you would like to go to: 
echo. 
set /p udefine= 
echo. 
echo *************************************************************** 
if %udefine%==1 (
    echo Give the parameters: 
    set /p argi= 
    set /p argii= 
    START /B java -jar JavaClient.jar !argi! !argii! 
) 

if %udefine%==e goto exit 

cls 
echo *************************************************************** 
echo. 
echo Thank You for using it 
echo. 
echo *************************************************************** 
echo Type [e] to exit or [b] to go back and select another option. 
echo. 
set /p udefine= 
echo. 
echo *************************************************************** 
if %udefine%==b goto top 
if %udefine%==e goto exit 
:exit 
cls 
echo *************************************************************** 
echo. 
echo Thank You for using it 
echo. 
echo *************************************************************** 
pause 
exit 
+0

고마워요! 그것은 매력처럼 일했습니다! – Andrew