@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
如果要测试,请在桌面上制作名为AH1和AH2的2个批处理文件 它说Access拒绝....为什么??
答案 0 :(得分:0)
无论您将哪些内容放入option
变量,总是转到:yes
。
我猜你在使用choice
命令时混淆了因为errorlevel
不包含你在set
命令时选择的选项。< / p>
来自set
文档:
%ERRORLEVEL% - 扩展到当前的ERRORLEVEL值
因此,您可能希望将if %errorlevel% equ no goto no
更改为if %option% equ no goto no
。
此外,如果您未放置yes
或no
,会发生什么。您需要在第二个exit
语句之后使用if
命令来解释这些问题。