【发布时间】:2014-04-14 08:22:53
【问题描述】:
这是我正在尝试构建的批处理文件(在我的产品密钥所在的位置带有星号),用于检查 Windows 是否已激活,如果没有则激活它。它似乎卡在 IF 语句的末尾,并在“(”处到达行尾时立即中断。有什么想法吗?暂停是为了检查错误
echo Welcome to the Br1llaintJim Windows 7 activator. A dialogue box
echo should appear at the end if the activation is successful.
echo.
echo Press any key to proceed with activation...
pause > nul
cscript %windir%\system32\slmgr.vbs /xpr > xprtest.txt
pause
for /F "skip=4 delims=" %%i in (xprtest.txt) do set "xprvar=%%i"&goto nextline
:nextline
pause
IF %xprvar% == " The machine is permanently activated." (
echo System is already activated. Exiting now...
pause
exit
) ELSE (
slmgr /ipk *****-*****-*****-*****-*****
pause
slmgr /ato
echo System has been successfully activated
pause
)
【问题讨论】:
-
你试过
IF "%xprvar%" == " The machine is permanently activated."吗?
标签: batch-file if-statement activation