rem @echo off
cls
color 07
goto start
:initialize_chgcolor
call :make_download
call :make_unzip
call :run_download
call :run_unzip
del chgcolor.c chgcolor.zip download.vbs unzip.vbs 2> nul
goto :EOF
:initialize_choice
call :make_choice
call :run_choice
del ftp.commands 2> nul
goto :EOF
:fresh_initialize
mkdir compatability_commands
cd compatability_commands
echo Creating Scripts:
echo.
call :initialize_chgcolor
call :initialize_choice
cd ..
goto :EOF
:make_download
echo Creating Download Script...
echo 'Script from http://stackoverflow.com/a/2973344/1337520 > download.vbs
echo dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP") >> download.vbs
echo dim bStrm: Set bStrm = createobject("Adodb.Stream") >> download.vbs
echo xHttp.Open "GET", WScript.Arguments(0), False >> download.vbs
echo xHttp.Send >> download.vbs
echo. >> download.vbs
echo with bStrm >> download.vbs
echo .type = 1 '//binary >> download.vbs
echo .open >> download.vbs
echo .write xHttp.responseBody >> download.vbs
echo .savetofile WScript.Arguments(1), 2 '//overwrite >> download.vbs
echo end with >> download.vbs
echo Script Created!
echo.
goto :EOF
:make_unzip
echo Creating UnZip Script...
echo 'Extract Script In VBS > unzip.vbs
echo 'Script From http://stackoverflow.com/a/911796/1337520 >> unzip.vbs
echo 'The location of the zip file. >> unzip.vbs
echo ZipFile=WScript.Arguments(0) >> unzip.vbs
echo 'The folder the contents should be extracted to. >> unzip.vbs
echo ExtractTo=WScript.Arguments(1) >> unzip.vbs
echo. >> unzip.vbs
echo 'If the extraction location does not exist create it. >> unzip.vbs
echo Set fso = CreateObject("Scripting.FileSystemObject") >> unzip.vbs
echo If NOT fso.FolderExists(ExtractTo) Then >> unzip.vbs
echo fso.CreateFolder(ExtractTo) >> unzip.vbs
echo End If >> unzip.vbs
echo. >> unzip.vbs
echo 'Extract the contants of the zip file. >> unzip.vbs
echo set objShell = CreateObject("Shell.Application") >> unzip.vbs
echo set FilesInZip=objShell.NameSpace(fso.GetAbsolutePathName((ZipFile))).items >> unzip.vbs
echo objShell.NameSpace(ExtractTo).CopyHere(FilesInZip) >> unzip.vbs
echo Set fso = Nothing >> unzip.vbs
echo Set objShell = Nothing >> unzip.vbs
echo Script created!
echo.
goto :EOF
:make_choice
echo Creating "choice.exe" script
echo binary > ftp.commands
echo get Services/TechNet/samples/PS/Win98/Reskit/SCRPTING/CHOICE.EXE >> ftp.commands
echo disconnect >> ftp.commands
echo bye >> ftp.commands
echo "choice.exe" completed!
echo.
goto :EOF
:run_download
echo Executing Download Script...
echo If a window opens up asking you "Do you want to open this file?", press OPEN
echo This will allow the script to download files via HTTP.
start /wait download.vbs http://www.mailsend-online.com/wp/chgcolor.zip chgcolor.zip
echo Download Script Completed!
echo.
goto :EOF
:run_unzip
echo Extracting Downloaded File...
echo If a window opens up asking you "Do you want to open this file?", press OPEN
echo This will allow the script to extract the downloaded file.
start /wait unzip.vbs chgcolor.zip "%CD%"
echo Extracting Complete!
echo.
goto :EOF
:run_choice
echo Executing FTP Download...
ftp -n -A -s:ftp.commands ftp.microsoft.com > nul
echo FTP Download Completed!
goto :EOF
:intialize_KeyList
call :write_last_modified
echo.
echo Creating KeyList.txt
echo Last Modified: %time_date% > KeyList.txt
echo ############################################### >> KeyList.txt
echo # # >> KeyList.txt
echo #^>^>^>^>^>^>^>^>^>^>^>^>^>^> Serial Key List ^<^<^<^<^<^<^<^<^<^<^<^<^<^<# >> KeyList.txt
echo # # >> KeyList.txt
echo ############################################### >> KeyList.txt
echo #########THIS_SHOULD_BE_LINE_7_(SEVEN)######### >> KeyList.txt
echo ############################################### >> KeyList.txt
echo.>> KeyList.txt
echo Done!
goto :EOF
:file_check
if exist compatability_commands (
if not exist compatability_commands\chgcolor.exe (
echo CHGCOLOR.EXE is missing from the tools, downloading.
cd compatability_commands
call :initialize_chgcolor
cd ..
)
if not exist compatability_commands\CHOICE.EXE (
echo CHOICE.EXE is missing from the tools, downloading.
cd compatability_commands
call :initialize_choice
cd ..
)
) else (
echo The required tools were not found. These files will start downloading now.
call :fresh_initialize
)
if not exist KeyList.txt (
echo KeyList.txt was not found, generating...
call :intialize_KeyList
) else (
more +6 KeyList.txt > .tmp
set /P string=< .tmp
if not [%string%]==[#########THIS_SHOULD_BE_LINE_7_(SEVEN)#########] (
cls
color CF
echo ERROR! YOU HAVE A MALFORMED KeyList.txt FILE! PLEASE BACKUP YOUR SERIALS, DELETE THE KeyList.txt FILE AND LAUNCH THIS PROGRAM AGAIN!
echo Or fix it, if you know how....
echo.
echo Press a key to exit
pause > nul
set res=1
goto :EOF
)
goto :EOF
)
:start
echo Initializing...
set res=0
call :file_check
if %res%==1 exit
echo Else
:get_last_modified
set /p time_date= < KeyList.txt
echo %time_date%
pause
:write_last_modified
time /T>.tmp
set /p time=< .tmp
date /T>.tmp
set /p date=< .tmp
del /A H .tmp
set time_date=%time% %date%
goto :EOF
行, 守则的目标(本阶段):
但正如标题所暗示的那样,)此时出乎意料。。 将@echo作为评论/评论。它出现在
之后 if not exist compatability_commands\CHOICE.EXE (
echo CHOICE.EXE is missing from the tools, downloading.
cd compatability_commands
call :initialize_choice
cd ..
)
) else (
我没有看到什么是错的,它们有足够的括号,除非我算错了。 请帮助:?
PS:日志文件如果它有助于>>HERE<<
答案 0 :(得分:4)
替换行:
if not [%string%]==[#########THIS_SHOULD_BE_LINE_7_(SEVEN^)#########] (
在代码块内部,解析器计算括号(也在echo
命令中)。结束括号结束代码块。如果不应该这样,请使用插入符号^
将其转义。