0
@echo off
color 4
ping localhost 2.5 > nul
echo Welcome to the configuration menu.
echo Move AH1.exe and AH2.exe to your desktop.
echo This only works the first time
echo SO BE CAREFUL!
echo Would you like this to start on computer startup?
echo say "yes" or "no" below.
set /p option=Option:

IF %ERRORLEVEL% EQU no goto no
IF %ERRORLEVEL% EQU yes goto yes
:yes
echo Move AH1.bat and AH2.bat to desktop.
::Copies files to dekstop of current user *For Windows 7
xcopy "%systemdrive%\users\%username%\Desktop\AH1.bat" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
xcopy "%systemdrive%\users\%username%\Desktop\AH2.bat" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"

echo Moved.
echo Press any key to close Anti Hacker Configuration.
pause > nul
exit
:no
echo No?The program will not take full effect then.
pause
exit

如果您想测试,请在您的桌面上制作 2 个批处理文件,分别称为 AH1 和 AH2,上面写着 Access Denied....为什么?

4

1 回答 1

0

无论您将什么放入option变量中,它总是会转到:yes.

我猜您choice在制作此命令时与命令混淆了,因为errorlevel不包含您在拥有set命令时选择的选项。

set文档中:

%ERRORLEVEL% - 扩展为当前的 ERRORLEVEL 值

因此,您可能希望更改if %errorlevel% equ no goto noif %option% equ no goto no.

另外,如果你不放或者yes也不放会发生什么no。您可能需要通过exit在第二if条语句之后使用命令来解决这些问题。

于 2013-03-16T23:18:38.727 回答