2014-12-31 38 views
1

我無法找到我花了很長時間嘗試解決此錯誤的錯誤,但找不到錯誤。批處理:命令的語法不正確?

批處理文件不斷給我當我運行下面的代碼時,該命令的語法不正確

它有什麼問題?

代碼:

@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'的變量。 (我不知道Windows批處理語法是否足以進一步評論。) –

+0

將@echo關閉。你可以找出它出錯的地方 –

+0

我沒有想到我會嘗試它謝謝。 –

回答

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

goto標籤:Runing如果errorlevel0和標籤:Not否則(既然not是一個批次的關鍵字,這對於是一個可怕的,但不是非法的名字標籤)

由於變量「Then」等在此時尚未建立,它們將被它們的第th當前值(即。什麼都沒有) - 嗯,在這樣的代碼塊中,我不會費心去研究結果。按照關於@echo off的註釋,將顯示構造命令的語法錯誤。