2014-12-31 7 views
1

오류를 찾을 수 없습니다. 오랫동안이 오류를 해결하는 데 시간을 썼지 만 오류를 찾을 수 없습니다.배치 : 명령 구문이 잘못 되었습니까?

배치 파일이 계속 내게 다음 코드를 실행할 때 명령 구문이 올바르지 않습니다.

무엇이 문제입니까?

코드 : 0입니다 :Runingerrorlevel 경우

@echo off 

whoami /groups | find "S-1-16-12288" > nul 

if %errorlevel% == 0 (
goto :Runing in Admin Mode 
) ELSE (
goto :Not Runing in Admin Mode 
) 

if %errorlevel% == 2 (
goto :Not Runing in Admin Mode 
) ELSE (
goto :Runing in Admin Mode 
) 

SET AND=IF 
SET THEN=(
SET ELSE=) ELSE (
SET NOELSE= 
SET ENDIF=) 
SET BEGIN=(
SET END=) 
SET RETURN=EXIT /B 

:Runing in Admin Mode 
if %errorlevel% == 0 (
echo Runing in Admin Mode 
echo. 
attrib -h FileCompressionTool.bat 

IF EXIST "upx.exe" %THEN% 
attrib -h upx.exe 
set missingfilesFalse=False 
%ELSE% 
echo upx.exe. missing. 
set missingfilesTrue=True 
ping >nul 3 %THEN% 

IF EXIST "mpress.exe" %THEN% 
attrib -h mpress.exe 
set missingfilesFalse=False 
%ELSE% 
echo mpress.exe. missing. 
set missingfilesTrue=True 
ping >nul 3 
%THEN% 

IF EXIST strip.exe %THEN% 
attrib -h strip.exe 
%ELSE% 
echo strip.exe. missing. 
set missingfilesTrue=True 
ping >nul 3 %THEN% 

IF EXIST reshacker.exe %THEN% 
attrib -h reshacker.exe 
%ELSE% 
echo reshacker.exe. missing. 
set missingfilesTrue=True 
ping >nul 3 %THEN% 

IF EXIST reshacker.ini %THEN% 
attrib -h reshacker.ini 
%ELSE% 
echo reshacker.ini. missing. 
set missingfilesTrue=True 
ping >nul 3 %THEN% 

IF EXIST reshacker.Log %THEN% 
attrib -h reshacker.Log 
%ELSE% 
echo reshacker.Log. missing. 
set missingfilesTrue=True 
ping >nul 3 %THEN% 

%NOELSE% 
%ENDIF% 
%NOELSE% 
%ENDIF% 
%NOELSE% 
%ENDIF% 
%NOELSE% 
%ENDIF% 
%NOELSE% 
%ENDIF% 
%NOELSE% 
%ENDIF% 

cls 

:Not Runing in Admin Mode 
if %errorlevel% == 2 (
echo Not Runing in Admin Mode 
echo. 

attrib -h FileCompressionTool.bat 

IF EXIST "upx.exe" %THEN% 
attrib -h upx.exe 
set missingfilesFalse=False 
%ELSE% 
echo upx.exe. missing. 
set missingfilesTrue=True 
ping >nul 3 %THEN% 

IF EXIST "mpress.exe" %THEN% 
attrib -h mpress.exe 
set missingfilesFalse=False 
%ELSE% 
echo mpress.exe. missing. 
set missingfilesTrue=True 
ping >nul 3 
%THEN% 

IF EXIST strip.exe %THEN% 
attrib -h strip.exe 
%ELSE% 
echo strip.exe. missing. 
set missingfilesTrue=True 
ping >nul 3 %THEN% 

IF EXIST reshacker.exe %THEN% 
attrib -h reshacker.exe 
%ELSE% 
echo reshacker.exe. missing. 
set missingfilesTrue=True 
ping >nul 3 %THEN% 

IF EXIST reshacker.ini %THEN% 
attrib -h reshacker.ini 
%ELSE% 
echo reshacker.ini. missing. 
set missingfilesTrue=True 
ping >nul 3 %THEN% 

IF EXIST reshacker.Log %THEN% 
attrib -h reshacker.Log 
%ELSE% 
echo reshacker.Log. missing. 
set missingfilesTrue=True 
ping >nul 3 %THEN% 

%NOELSE% 
%ENDIF% 
%NOELSE% 
%ENDIF% 
%NOELSE% 
%ENDIF% 
%NOELSE% 
%ENDIF% 
%NOELSE% 
%ENDIF% 
%NOELSE% 
%ENDIF% 

cls 

IF EXIST "%~1" %THEN% 
SET "result=%~1" 
%ELSE% 
SET "result=" 
%ENDIF% 

set False= Pause 

set True=echo Some file are missing this program may not work correctly please Re-download           **File Compression Tool** 


echo 1 UPX Compression 
echo 2 Mpress Compression 
echo 3 Decompress a file 
echo 4 Remove VB6 default icon 
echo Type exit to exit 
echo. 
if "%missingfilesTrue%"=="True" %true% 

Set /p choice= 
If %choice%==1 goto :1 
If %choice%==2 goto :2 
If %choice%==3 goto :3 
If %choice%==4 goto :4 
If %choice%==exit goto :exit 

if %missingfilesTrue%==True(
%true% 
) else (
if %missingfilesFalse%==False 
%False% 
) 

goto :exit 

:1 
cls 
echo ***Drag your exe file into this window and press enter*** 
set /p File=: 
echo. 
copy %file% %file%.bak 
upx --best %file% 
echo. 
echo Done! 
echo Press any key to exit. . . 
pause >nul 
goto exit 

:2 
cls 
echo ***Drag your exe file into this window and press enter*** 
set /p file=: 
echo. 
copy %file% %file%.bak 
Mpress -s %file% 
echo. 
echo Done! 
echo Press any key to exit. . . 
pause >nul 
goto exit 

:3 
cls 
echo ***Drag your exe file into this window and press enter*** 
set /p file=: 
echo. 
copy %file% %file%.bak 
upx -d %file% 
echo. 
echo Done! 
echo Press any key to exit. . . 
pause >nul 
goto exit 

:4 
cls 
echo ***Drag your exe file into this window and press enter*** 
set /p thefile=: 

(
reshacker -delete %thefile%, %thefile%, ICONGROUP, 1, 0 
) 

strip -s --strip-all -g -S -d --strip-debug -x --discard-all -X --discard-locals %thefile% 
upx -9 %thefile% 
echo. 
echo Done! 
echo Press any key to exit. . . 
pause >nul 
goto exit 

:exit 
Exit 
+0

레이블 이름에 공백이있을 수 있다고 생각하지 않습니다. 또한,'% THEN %'은 옳지 않습니다; 그것은'THEN'이라는 변수를 참조 할 것입니다. (나는 윈도우 배치 문법에 대해 충분히 논평 할만큼 잘 모른다.) –

+0

@echo가 해제 된 줄을 제거한다. 당신은 그것이 잘못되어 가고있는 것을 발견 할 수 있습니다. –

+0

나는 그것에 대해 감사 할 것이라고 생각하지 않았습니다. –

답변

1
if %errorlevel% == 0 (
goto :Runing in Admin Mode 
) ELSE (
goto :Not Runing in Admin Mode 
) 

레이블을 goto하고 not가 배치 키워드이기 때문에, 그렇지 않으면 라벨 :Not에 (그리고, 그건에 대한 끔찍한하지만 불법 이름의 레이블)

변수 "Then"등이 그 시점에서 설정되지 않았기 때문에, 그들은 th로 대체 될 것입니다 현재 값 (ie. 아무 것도 아닙니다.) - 음, 그런 코드 조각에서, 나는 결과를 계산하는 것을 괴롭히지 않을 것입니다. @echo off에 대한 주석을 따르고 구성된 명령의 구문 오류가 표시됩니다.

관련 문제