I would just like to thank EVERYONE so much for their help on this.
The above TWO codes do indeed run the Commands that I used just as an example. However, they both open the Commands and will NOT carry on until the Programs are closed, hence, I need to be at the computer until ALL the Commands have run and been closed.
What I ideally want, is to be able to initially just select the Commands that I DO want to run and ignore the Commands that I do NOT want to run, and then hit a key to start the run of ALL the specified selections, obviously waiting for each Command to finish before it runs the next. This way, I can leave the computer running without any user intervention, hence the code I initially posted.
Here is a small selection [ there are quite a few more ] to show what sort of things I will be running . . .
Code: Select all
@echo off
set "Dism=%SystemRoot%\System32\Dism.exe"
set "CBS_ALL=%WinDir%\Logs\CBS\*.*"
set "CBS_log=%WinDir%\Logs\CBS\CBS.log"
set "CBS_Persist_cab=%WinDir%\Logs\CBS\CbsPersist*.cab"
set "CBS_Persist_log=%WinDir%\Logs\CBS\CbsPersist*.log"
set "CBS_Persist_txt=%WinDir%\Logs\CBS\CbsPersist*.txt"
set "DIS_log=%WinDir%\Logs\DISM\DISM.log"
set "TSH=%LocalAppData%\ElevatedDiagnostics"
:Component
echo. & echo ######################################################################################################################################################################
echo # #
echo # Component Store - Cleanup the [ %WinDir%\WinSxS ] Component Store folder:- #
echo # #
echo ######################################################################################################################################################################
echo. & echo Processing . . .
taskkill /im TiWorker.exe /f 1>nul 2>nul
taskkill /im TrustedInstaller.exe /f 1>nul 2>nul
%Dism% /Online /Cleanup-Image /StartComponentCleanup
echo. & echo Processing Complete.
:TroubleShooting
echo. & echo ######################################################################################################################################################################
echo # #
echo # TroubleShooting History - Delete the [ %TSH% ] folder:- #
echo # #
echo ######################################################################################################################################################################
echo. & echo Processing . . .
if exist %TSH% (rmdir /s /q %TSH% >nul 2>&1)
echo Processing Complete.
:CBS
echo. & echo ######################################################################################################################################################################
echo # #
echo # CBS - Delete ALL [ %WinDir%\Logs\CBS\ ] files:- #
echo # #
echo ######################################################################################################################################################################
echo. & echo Processing . . .
if exist %CBS_ALL% (del /f /q %CBS_ALL% >nul 2>&1)
echo Processing Complete.
:DISM
echo. & echo ######################################################################################################################################################################
echo # #
echo # DISM - Delete the [ %DIS_Log% ] file:- #
echo # #
echo ######################################################################################################################################################################
echo. & echo Processing . . .
if exist %DIS_log% (del /f /q %DIS_log% >nul 2>&1)
echo Processing Complete.
echo. & echo ================================================================================ EOF =================================================================================
echo. & goto :REBOOT_Choice
:REBOOT_Choice
CHOICE /C:YN /M ">Do you want to REBOOT NOW"
if %ErrorLevel%==2 goto :No
if %ErrorLevel%==1 goto :Yes
:Yes
cls & color A & echo. & echo REBOOTING NOW . . . & timeout /t 3 /nobreak >nul & shutdown /r /f /t 00
:No
Exit /b
I hope I have explained this a bit clearer.
If this is not possible, then please just say, as there are other members who probably have a greater need for your expert help than myself, as this is just for personal use, whereas theirs maybe for work.
Thank you.