On the All User desktop I have a shortcut with the name SHUTDOWN
This starts in "H:\New Portable\CCleaner" and invokes
"H:\New Portable\CCleaner\Clean.cmd" - /AUTO /SHUTDOWN
My desktop also holds links that invoke
"H:\New Portable\CCleaner\Clean.cmd" DEFAULT
and
"H:\New Portable\CCleaner\Clean.cmd" ALAN
At H:\New Portable\CCleaner I have Portable CCleaner, and these INI files :-
Default.ini; Alan.ini; and Winapp2.ini
In the same folder is my CLEAN.CMD script :-
@ECHO OFF
SET LEVEL=DEFAULT& IF EXIST %1.INI SET LEVEL=%1
COPY %LEVEL%.INI CCLEANER.INI > NUL
ECHO USING %LEVEL%.INI
REM ### START of Purging Foxmarks (All non-English languages)
PUSHD .
IF “%1%3” NEQ “ALAN” GOTO SKIP
echo Purging foreign languages from Xmarks
CD /D %APPDATA%\Mozilla\Firefox\Profiles*.DEF\EXTENS~1\FOXMAR~1.COM\chrome\locale
IF NOT EXIST F* GOTO SKIP
DIR | FIND “/”
SET ANS=N & SET /P ANS="PURGE all above except en-US ? P(urge) / N(o) :- "
IF %ANS% NEQ P GOTO SKIP
ECHO PURGING …
FOR /D %%X IN (*) DO IF NOT %%X==en-US RMDIR /S /Q %%X
PAUSE
:SKIP
POPD
REM ### END of Purging Foxmarks
IF “%3” NEQ “/SHUTDOWN” START CCLEANER %2 & EXIT
ECHO %TIME% LAUNCH “CCLEANER %2” and WAIT; then do SHUTDOWN
CCLEANER %2
echo %TIME%
REM ### Erunt Backup etc.
FOR /F “tokens=1-4 delims=:.” %%d in (“%TIME%”) do (
SET /A T1=%%d360000+1%%e6000+1%%f100+1%%g-610100
)
echo C:\PROGRA~1\ERUNT\AUTOBACK.EXE C:\Windows\ERDNT\AutoBackup#Date##Time# sysreg curuser otherusers
C:\PROGRA~1\ERUNT\AUTOBACK.EXE C:\Windows\ERDNT\AutoBackup#Date##Time# sysreg curuser otherusers
echo %TIME%
FOR /F “tokens=1-4 delims=:.” %%d in (“%TIME%”) do (
SET /A T2=%%d360000+1%%e6000+1%%f100+1%%g-610100-%T1%
)
FOR /L %%x IN (6,-1,1) DO (
<NUL SET /P Z=%%x ERUNT took %T2%0. mSec
ping -w 40 -n 2 127.0.0.1 > nul
)
START “ALL DONE” SHUTDOWN -s -t 10 -c “CClean + Shutdown” -d p:2:4
CLEAN.CMD has evolved through many stages and is a now a little disjointed - but it works for me.
I have always used it to over-write CCleaner.ini with a chosen template.ini to determine the severity of cleaning.
CCleaner.ini is always over-written when Clean.cmd runs.
When CCleaner is run the GUI can change the cleaning options and CCleaner.ini will be suitably changed.
If you want to use the same options again then after closing CCleaner.exe you can rename CCleaner.ini as yet another "template" that can be invoked.
At one time the template was %USERNAME%.INI so it gave the whole system a good "seeing to" when I was running it,
and when my daughter ran it the system was preserved and only her private profile was cleaned.
Now the "template" is determined by the first argument %1 given to Clean.cmd.
If %1.INI exists then that template is used, otherwise DEFAULT.INI is used.
ALAN.INI cleans hard. Default.ini is more gentle and trusted to work with /AUTO
At one time CCleaner was always given the %2 %3 arguments,
but I found that sometimes /shutdown would fail
and Windows Task manager would show that half the processes were still running,
After which CCleaner was still able to be launched but could NOT shutdown,
and I deduce that shutdown depended upon one of the processes that had been killed,
so now I use Windows SHUTDOWN.EXE
Regards
Alan