我无法找到我花了很长时间尝试修复此错误但我无法找到错误的错误。
当我运行以下代码时,批处理文件一直给我命令的语法。
它有什么问题?
代码:
@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 :(得分:1)
if %errorlevel% == 0 (
goto :Runing in Admin Mode
) ELSE (
goto :Not Runing in Admin Mode
)
如果goto
为:Runing
,则errorlevel
标记为0
,否则为:Not
标签not
,因为@echo off
是批量关键字,这是一个标签的可怕但非法的名称)
由于变量"然后"在那时还没有建立它们,它们将被它们当时的当前值(即没有任何东西)所取代 - 而且 - 在这样一块代码中,我不会费心去研究结果。按照关于{{1}}的注释,将显示构造命令的语法错误。