It flashed and did not indicate that it was creating a text file.
This was the text file:
Code:
@echo off & cd /d "%~dp0" & Title Please wait. Do not close this window.
Setlocal EnableDelayedExpansion & If "%1"=="[Progress]" (Goto %2)
::———————————————————————————————————————————————————————————————————————————————————
For /F "tokens=*" %%# in ('"PowerShell (New-Object -ComObject Wscript.Shell).SpecialFolders(4)"') Do (Set "[DT]=%%#")
If not exist "%[DT]%" (Set "[DT]=%[DT]:~1%")
Set "OK=%[DT]%\Tuneup.log"
Set "[Zfile]=%[DT]%\Tuneup_log"
Set "T=%Temp%\T.txt"
Set "TT=%Temp%\TT.txt"
Set "[0]=%Temp%\0.txt"
Set "Log=%Temp%\Tuneup.log"
Set "[SFC]=%Temp%\SFC_details.txt"
Set "(Log)="%T%" && For /F "tokens=*" %%# in ('"More "%T%""') Do (Echo %%#>>"%Log%")"
Set "[|]=For /F "tokens=*" %%# in ('"More "%T%""') Do (Call"
Del /F /Q "%Log%" 2>Nul & Del /F /Q "%TT%" 2>Nul
::———————————————————————————————————————————————————————————————————————————————————
::The following is for the first SFC /ScanNow.
Echo Started on %date% at %time% >>"%Log%"
Echo.>>"%Log%"
Echo [SFC /ScanNow] >> "%Log%"
Echo.>>"%Log%"
(Del /F /Q "%[0]%" 2>nul & DEL /F /Q "%T%" 2>Nul
SFC /ScanNow >"%T%"
Echo. >"%[0]%")|%0 [Progress] [Of_SFC_ScanNow]
Goto [Post_SFC_ScanNow]
:[Of_SFC_ScanNow]
mode con cols=65 lines=6 &Echo.
Echo Operation (1): SFC.exe is checking the system files.&Echo.
Set "[CBS]=%WinDir%\Logs\CBS\CBS.log"
For /f %%# in ('Copy /Z "%~dpf0" Nul') Do (Set "[#]=%%#")
For /f %%L in ('FIND /V /C "" ^< %[CBS]%') Do (Set /A [L]=%%L-1)
For /L %%N in (0) Do (For /f "tokens=*" %%# in (
'More "%[CBS]%" +%[L]%^|Findstr /C:"[SR]"^|Findstr /C:" 100 "^|FIND /V /C ""') Do (Set "[N]=%%#00")
Set /P "=.![#]! -^> About ![N]! files have been processed. ![#]!" <NUL
If exist "%[0]%" Exit
Ping -n 5 127.0.0.1 >Nul)
Goto:EOF
:[Post_SFC_ScanNow]
Cls & Echo. & Echo. & Set "[Num]=0"
Echo SFC.exe has finished checking the system files.
Echo Writing the output into the LOG file...
For /F "tokens=*" %%# in ('"More "%T%""') Do (Call:[Screening_1] "%%#")
Del "%T%" & Echo.>>"%Log%" & Set "Check="
Set "[Num]=0"
Goto [Operations_2]
:[Screening_1]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
Set /A [Num]+=1
If not "%Check%"=="No" If not "%Text%"=="%Text:did not find any integrity violations=%" (
Set "Result_1=No_errors"
Set "Check=No")
If not "%Text%"=="%Text:Beginning verification=%" (Echo.>>"%Log%"
Echo Results:>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
::掃描的進度記錄必定包含『 0 』 。無須把進度記錄寫入 %Log%
If not "%Text%"=="%Text: 0 =%" Goto:EOF
If not "%Text%"=="%Text:For online repairs=%" (Echo.>>"%Log%"
Echo %Text%>>"%Log%" & Goto:EOF)
Echo %Text%>>"%Log%"
Goto:EOF
::———————————————————————————————————————————————————————————————————————————————————
:[Operations_2]
::The following is for ScanHealth.
::先刪除上一個操作所留下來之訊息
Set "Text=Please be patient."
Echo ==================================================================>>"%Log%"
Echo.>>"%Log%"
Echo Started on %date% at %time% >>"%Log%"
Echo.>>"%Log%"
Echo [DISM /online /cleanup-image /ScanHealth] >> "%Log%"
Echo.>>"%Log%"
(Del /F /Q "%[0]%" 2>nul & DEL /F /Q "%T%" 2>Nul
DISM /online /cleanup-image /ScanHealth >"%T%"
Echo. >"%[0]%")|%0 [Progress] [Of_ScanHealth]
Goto [Post_ScanHealth]
:[Of_ScanHealth]
mode con cols=65 lines=6 & Cls & Echo.
Echo Operation (2): DISM is scanning the image of Windows.&Echo.
For /f %%# in ('Copy /Z "%~dpf0" Nul') Do (Set "[#]=%%#")
For /L %%# in (0) Do (
For /f "delims=" %%# in ('Type "%T%"') Do (Set "Text=%%#")
Set /P "=.![#]! -^> !Text! ![#]!" <NUL
If exist "%[0]%" Exit
Ping -n 5 127.0.0.1 >Nul)
Goto:EOF
:[Post_ScanHealth]
Echo. & Echo.&Echo DISM has finished scanning the image of Windows.
Echo Writing the output into the LOG file...
For /F "tokens=*" %%# in ('"More "%T%""') Do (Call:[Screening_2] "%%#")
Del "%T%" & Echo.>>"%Log%" & Goto [Operations_3]
:[Screening_2]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
If not "%Text%"=="%Text:Image Version=%" (Echo.>>"%Log%"
Echo %Text%>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
If not "%Text%"=="%Text:completed successfully=%" (Echo.>>"%Log%"
Echo %Text%>>"%Log%" & Goto:EOF)
If "%Text%"=="%Text:[===%" (Echo %Text%>>"%Log%")
Goto:EOF
::———————————————————————————————————————————————————————————————————————————————————
:[Operations_3]
::The following is for RestoreHealth.
::先刪除上一個操作所留下來之訊息
Set "Text=Please be patient."
Echo ==================================================================>>"%Log%"
Echo.>>"%Log%"
Echo Started on %date% at %time% >>"%Log%"
Echo.>>"%Log%"
Echo [DISM /online /cleanup-image /RestoreHealth] >> "%Log%"
Echo.>>"%Log%"
(Del /F /Q "%[0]%" 2>nul & DEL /F /Q "%T%" 2>Nul
DISM /online /cleanup-image /RestoreHealth >"%T%"
Echo. >"%[0]%")|%0 [Progress] [Of_RestoreHealth]
Goto [Post_RestoreHealth]
:[Of_RestoreHealth]
mode con cols=65 lines=6 & Cls & Echo.
Echo Operation (3): DISM is restoring the health of Windows.&Echo.
For /f %%# in ('Copy /Z "%~dpf0" Nul') Do (Set "[#]=%%#")
For /L %%# in (0) Do (
For /f "delims=" %%# in ('Type "%T%"') Do (Set "Text=%%#")
Set /P "=.![#]! -^> !Text! ![#]!" <NUL
If exist "%[0]%" Exit
Ping -n 5 127.0.0.1 >Nul)
Goto:EOF
:[Post_RestoreHealth]
Echo. & Echo.&Echo DISM has finished restoring the health of Windows.
Echo Writing the output into the LOG file...
Set "[S1]=Use the "Source" option to specify the location of the files that are required to restore the feature."
Set "[S2]=For more information on specifying a source location, see https://go.microsoft.com/fwlink/?LinkId=243077."
For /F "tokens=*" %%# in ('"More "%T%""') Do (Call:[Screening_3] "%%#")
Del "%T%" & Echo.>>"%Log%" & Goto [Operation_4]
:[Screening_3]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
If not "%Text%"=="%Text:Image Version=%" (Echo.>>"%Log%"
Echo %Text%>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
If not "%Text%"=="%Text:The source files could not be found=%" (Echo.>>"%Log%"
Echo %Text%>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
If "%Text%"=="%[S1]% %[S2]%" (Echo %[S1]%>>"%Log%" & Echo %[S2]%>>"%Log%" & Goto:EOF)
If not "%Text%"=="%Text:The operation completed=%" (Echo.>>"%Log%"
Echo %Text%>>"%Log%" & Goto:EOF)
If "%Text%"=="%Text:[===%" (Echo %Text%>>"%Log%")
Goto:EOF
::———————————————————————————————————————————————————————————————————————————————————
:[Operation_4]
::The following is for the second SFC /ScanNow.
::先刪除上一個操作所留下來之訊息
Set "Text=Please be patient."
Echo ==================================================================>>"%Log%"
If "%Result_1%"=="No_errors" (Echo.>>"%Log%"
Echo The second "SFC /ScanNow" was skipped, as the first output the following:>> "%Log%"
Echo.>>"%Log%"&Echo Windows Resource Protection did not find any integrity violations.>>"%Log%"
Echo.>>"%Log%" & mode con cols=94 lines=6 & Goto [Operation_5])
Echo.>>"%Log%"
Echo Started on %date% at %time% >>"%Log%"
Echo.>>"%Log%"
Echo [SFC /ScanNow] >> "%Log%"
Echo.>>"%Log%"
(Del /F /Q "%[0]%" 2>nul & DEL /F /Q "%T%" 2>Nul
SFC /ScanNow >"%T%"
Echo. >"%[0]%")|%0 [Progress] [Of_SFC_ScanNow_2]
Goto [Post_SFC_ScanNow_2]
:[Of_SFC_ScanNow_2]
mode con cols=65 lines=6 & Cls & Echo.
Echo Operation (4): SFC.exe is rechecking the system files.&Echo.
Set "[CBS]=%WinDir%\Logs\CBS\CBS.log"
For /f %%# in ('Copy /Z "%~dpf0" Nul') Do (Set "[#]=%%#")
For /f %%L in ('FIND /V /C "" ^< %[CBS]%') Do (Set /A [L]=%%L-1)
For /L %%N in (0) Do (For /f "tokens=*" %%# in (
'More "%[CBS]%" +%[L]%^|Findstr /C:"[SR]"^|Findstr /C:" 100 "^|FIND /V /C ""') Do (Set "[N]=%%#00")
Set /P "=.![#]! -^> About ![N]! files have been processed. ![#]!" <NUL
If exist "%[0]%" Exit
Ping -n 5 127.0.0.1 >Nul)
Goto:EOF
:[Post_SFC_ScanNow_2]
Echo. & Echo.&Echo SFC.exe has finished rechecking the system files.
Echo Writing the output into the LOG file...
Set "[Num]=0"
For /F "tokens=*" %%# in ('"More "%T%""') Do (Call:[Screening_4] "%%#")
Del "%T%" & Echo.>>"%Log%" & Set "[Num]=0"
Findstr /C:"[SR]" "%WinDir%\Logs\CBS\CBS.log">"%[SFC]%"
Echo ==================================================================>>"%Log%"
Echo.>>"%Log%"
More "%[SFC]%"|Find "[SR]">NUL && (Set "[ZIP]=Yes"
Echo A TXT file named SFC_details.txt has been created.>> "%Log%")||(
Echo SFC_details.txt is blank and thus has been excluded.>> "%Log%")
Echo.>>"%Log%" & mode con cols=94 lines=6 & Goto [Operation_5]
:[Screening_4]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
Set /A [Num]+=1
If not "%Text%"=="%Text:Beginning verification=%" (Echo.>>"%Log%"
Echo Results:>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
::掃描的進度記錄必定包含『 0 』 。無須把進度記錄寫入 %Log%
If not "%Text%"=="%Text: 0 =%" Goto:EOF
If not "%Text%"=="%Text:For online repairs=%" (Echo.>>"%Log%"
Echo %Text%>>"%Log%" & Goto:EOF)
Echo %Text%>>"%Log%"
Goto:EOF
::———————————————————————————————————————————————————————————————————————————————————
:[Operation_5]
::The following is for ChkDsk /Scan.
::先刪除上一個操作所留下來之訊息
Set "Text=Please be patient."
Echo ==================================================================>>"%Log%"
Echo.>>"%Log%"
Echo Started on %date% at %time% >>"%Log%"
Echo.>>"%Log%"
Echo [ChkDsk /Scan] >> "%Log%"
Echo.>>"%Log%"
mode con cols=94 lines=6 & Echo.
Echo Operation (5): Chkdsk.exe is scanning the system disk for problems.&Echo.
(Del /F /Q "%[0]%" 2>nul
cd /d "%SystemDrive%" & ChkDsk /Scan >>"%T%" & cd /d "%~dp0"
Echo. >"%[0]%")|%0 [Progress] [Of_ChkDsk_scan]
Cls & Goto [Post_ChkDsk_scan]
:[Of_ChkDsk_scan]
For /f %%# in ('Copy /Z "%~dpf0" Nul') Do (Set "[#]=%%#")
For /L %%# in (0) Do (For /f "delims=" %%# in ('Type "%T%"') Do (Set "Text=%%#")
Set /P "=.![#]! !Text!![#]!" <NUL & If exist "%[0]%" Exit
Ping -n 5 127.0.0.1 >Nul)
Goto:EOF
:[Post_ChkDsk_scan]
Echo. & Echo.&Echo Chkdsk.exe has finished scanning the system disk.
Echo Writing the output into the LOG file...
PowerShell GC '"%T%"'^|Select-string -pattern 'ETA:.*' -notmatch^|Out-File '"%TT%"'
::---------------------------------------------------------------------------------
:: 以下五行指令用於處理多種複雜的錯誤情況, 其回報的資料必然包含此三個字元 ,0x
Set "[E1]=%Temp%\Tuneup_plus_log_Found_corrupt_basic_file_structure.txt"
If exist "%[E1]%" (Del /F /Q "%[E1]%")
PowerShell ^(GC '"%TT%"'^|%%{if($_ -like '"*,0x*"'){Echo E ^> '"%[E1]%"';Break}}^)
If exist "%[E1]%" (Del "%[E1]%" & MORE /E +1 "%TT%">>"%Log%" & Set "[E1]=Yes"
Goto [Final])
::---------------------------------------------------------------------------------
:: 如果回報的資料沒有包含上述的三個字元, 才會執行以下的 13 行指令。
:: 以下一行會把雙引號 " 改為星號 * 以免 [Screening_5] 執行失敗。
PowerShell ^(GC '"%TT%"'^|%%{$_-replace '""""', '"*"'}^)^|SC '"%TT%"'
PowerShell $X=GC '"%TT%"';$X[1..($X.count - 3)]^|Out-File '"%TT%"'
For /F "tokens=*" %%# in ('"More "%TT%""') Do (Call:[Screening_5] "%%#")
Echo.>>"%Log%" & Goto [Final]
:[Screening_5]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
If not "%Text%"=="%Text:Stage =%" Echo.>>"%Log%" & Echo %Text%>>"%Log%" & Goto:EOF
IF not "%Text%"=="%Text:Windows has =%" Echo.>>"%Log%"&Echo %Text%>>"%Log%"&Echo.>>"%Log%"&Goto:EOF
If not "%Text%"=="%Text:total disk=%" Echo.>>"%Log%" & Echo %Text%>>"%Log%" & Goto:EOF
If not "%Text%"=="%Text:in each=%" Echo.>>"%Log%" & Echo %Text%>>"%Log%" & Goto:EOF
Echo %Text%>>"%Log%"
Goto:EOF
::———————————————————————————————————————————————————————————————————————————————————
:[Final]
If "%[E1]%"=="Yes" PowerShell $X=GC '"%Log%"';$X[0..($X.count - 2)]^|Out-File '"%Log%"'
Del "%T%" & Del "%TT%"
Echo ==================================================================>>"%Log%"
(Echo. & Echo Started on %date% at %time% & Echo. )>>"%Log%"
WMIC recoveros get autoreboot >"%T%"
%[|]%:[get_autoreboot_1] "%%#")
Goto [Post_get_autoreboot_1]
:[get_autoreboot_1]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
If not "%Text%"=="%Text:AutoReboot=%" (
Echo %Text%>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
Echo %Text%>>"%Log%"
Goto:EOF
:[Post_get_autoreboot_1]
Echo.>>"%Log%"
Echo ==================================================================>>"%Log%"
Echo.>>"%Log%" & Echo [Set AutoReboot = False] >> "%Log%"
Echo.>>"%Log%" & WMIC recoveros set autoreboot = false >> "%Log%"
Echo ==================================================================>>"%Log%"
Echo.>>"%Log%"
WMIC recoveros get autoreboot >"%T%" & %[|]%:[get_autoreboot_2] "%%#")
Goto [Post_get_autoreboot_2]
:[get_autoreboot_2]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
If not "%Text%"=="%Text:AutoReboot=%" (
Echo %Text%>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
Echo %Text%>>"%Log%"
Goto:EOF
:[Post_get_autoreboot_2]
Echo.>>"%Log%"
Echo ==================================================================>>"%Log%"
Echo.>>"%Log%"
WMIC recoveros get DebugInfoType >"%T%" & %[|]%:[DebugInfoType_1] "%%#")
Goto [Post_DebugInfoType_1]
:[DebugInfoType_1]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
If not "%Text%"=="%Text:DebugInfoType=%" (
Echo %Text%>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
Echo %Text%>>"%Log%"
Goto:EOF
:[Post_DebugInfoType_1]
Echo.>>"%Log%"
Echo ==================================================================>>"%Log%"
(Echo.&Echo [Set DebugInfoType = 7]&Echo.)>> "%Log%"
WMIC recoveros set DebugInfoType = 7 >%(Log)%
Echo ==================================================================>>"%Log%"
Echo.>>"%Log%"
WMIC recoveros get DebugInfoType >"%T%" & %[|]%:[DebugInfoType_2] "%%#")
Goto [Post_DebugInfoType_2]
:[DebugInfoType_2]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
If not "%Text%"=="%Text:DebugInfoType=%" (
Echo %Text%>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
Echo %Text%>>"%Log%"
Goto:EOF
:[Post_DebugInfoType_2]
Echo.>>"%Log%"
Echo ==================================================================>>"%Log%"
(Echo.&Echo [WMIC PageFile list]&Echo.)>> "%Log%"
WMIC pagefile list /format:list >%(Log)%
Echo.>>"%Log%"
Echo ==================================================================>>"%Log%"
Echo.>>"%Log%"
wmic Computersystem where name="%computername%" get AutomaticManagedPagefile >"%T%"
%[|]%:[AutomaticManagedPagefile_1] "%%#")
Goto [Post_AutomaticManagedPagefile_1]
:[AutomaticManagedPagefile_1]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
If not "%Text%"=="%Text:AutomaticManagedPagefile=%" (
Echo %Text%>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
Echo %Text%>>"%Log%"
Goto:EOF
:[Post_AutomaticManagedPagefile_1]
Echo.>>"%Log%"
Echo ==================================================================>>"%Log%"
(Echo.&Echo [Set AutomaticManagedPagefile = True]&Echo.)>> "%Log%"
wmic Computersystem where name="%computername%" set AutomaticManagedPagefile=True >%(Log)%
Echo ==================================================================>>"%Log%"
Echo.>>"%Log%"
wmic Computersystem where name="%computername%" get AutomaticManagedPagefile >"%T%"
%[|]%:[AutomaticManagedPagefile_2] "%%#")
Goto [Post_AutomaticManagedPagefile_2]
:[AutomaticManagedPagefile_2]
Set "Text=%~1"
If "%Text%"=="" Goto:EOF
If not "%Text%"=="%Text:AutomaticManagedPagefile=%" (
Echo %Text%>>"%Log%" & Echo.>>"%Log%" & Goto:EOF)
Echo %Text%>>"%Log%"
Goto:EOF
:[Post_AutomaticManagedPagefile_2]
Echo.>>"%Log%"
Echo ==================================================================>>"%Log%"
(Echo.&Echo [BcdEdit /enum {badmemory}]&Echo.)>> "%Log%"
BcdEdit /enum {badmemory} >%(Log)%
Echo.>>"%Log%"
Echo ==================================================================>>"%Log%"
(Echo.&Echo Finished on %date% at %time%) >>"%Log%"
::———————————————————————————————————————————————————————————————————————————————————
Del "%T%" & Del /F /Q "%OK%" 2>Nul & Del /F /Q "%[0]%" 2>nul & Set "#=Echo Echo"
If "%[ZIP]%"=="Yes" Goto [Zip_the_files]
Move "%Log%" "%OK%" && Start "" Notepad "%OK%" & Set "CMD=%Temp%\CMD.cmd"
Set "[URL]=https://www.tenforums.com/bsod-crashes-debugging/162488-batch-files-use-bsod-debugging.html#Part2-1B"
(Echo @echo off^&Title Operations completed.^&mode con cols=77 lines=16^&color 17
%#% ###########################################################################
%#% # #
%#% # Tuneup_plus_log.bat #
%#% # #
%#% # A LOG file named Tuneup.log has been created on the desktop. #
%#% # Please copy the data from the file into your post ^(recommended^) #
%#% # or upload the file as an attachment to your post on Ten Forums. #
%#% # #
%#% # There are detailed instructions on how to properly copy the data. #
%#% # Batch files and instructions for use in BSOD debugging [Part Two] #
%#% # #
%#% # Press [V] to visit Ten Forums for the detailed instructions. #
%#% # Press [C] to close this window. #
%#% # #
%#% ###########################################################################
Echo CHOICE /C "VC" /M "Your choice?:" ^>nul 2^>^&1
Echo If %%errorlevel%%==1 ^(Start "" "%[URL]%"^)
Echo Exit)> "%CMD%" & Timeout 1 /nobreak>Nul & Start "" "%CMD%"
Del "%~f0" & Exit
::———————————————————————————————————————————————————————————————————————————————————
:[Zip_the_files]
For /f "tokens=2 delims==" %%# in ('WMIC OS Get localdatetime /value') Do (Set "T=%%#")
Set "Y=%T:~0,4%"
Set "M=%T:~4,2%"
Set "D=%T:~6,2%"
Set "H=%T:~8,2%"
Set "+=%T:~10,2%"
Set "S=%T:~12,2%"
Set "[ZIP]=%[Zfile]%-[%Y%-%M%-%D%_at_%H%-%+%-%S%]"
PowerShell Compress-Archive -Path """%Log%""", """%[SFC]%""" -DestinationPath """%[ZIP]%"""
Start "" "%[ZIP]%.zip" & Set "CMD=%Temp%\CMD.cmd"
(Echo @echo off^&Title Operations completed.^&mode con cols=75 lines=13^&color 17
%#% #########################################################################
%#% # #
%#% # Tuneup_plus_log.bat #
%#% # #
%#% # The following ZIP file has been created on the desktop. #
%#% # #
%#% # Tuneup_log-[%Y%-%M%-%D%_at_%H%-%+%-%S%].zip #
%#% # #
%#% # Please upload it as an attachment to your post on Ten Forums. #
%#% # You may press a key to close this window. #
%#% # #
%#% #########################################################################
Echo pause^>nul^&Exit)> "%CMD%" & Timeout 1 /nobreak>Nul & Start "" "%CMD%"
Del "%~f0" & Exit
::———————————————————————————————————————————————————————————————————————————————————