Batch: Clean Desktop

@echo off

REM moves graphic files to "Screenshots", other files to folder "_Desktop<timestamp>
REM demonstrates current date/time stamps AND "for (each) loops

setlocal
rem set debug=anythingbutblank
pushd %userprofile%\Desktop
if not exist Screenshots md Screenshots
:makedir with timestamp
set xtime=%time::=%
set xtime=%xtime:.=_%
set xdate=%date: =_%
set xdate=%xdate:/=_%
rem set xdate=%xdate:~4%
set xtime=%xtime:~0,-3%
rem set timestamp=%xdate%_%xtime%
set timestamp=%xdate%
set newdir=_Desktop_%timestamp%
if not "%debug%"=="" @echo on
if not exist %newdir% md %newdir%
rem excluded LNK URL
if not "%debug%"=="" echo newdir is: %newdir%
rem for %%x in (*.url *.lnk *.jpg *.pdf *.txt *.bak *.ahk *.doc* *.sql *.xls* *.png *.xml *.bmp *.gif *.log *.rtf *.htm? *.msg *.zip) do if exist "%%x" move "%%x" %newdir%
for %%x in ( *.csv *.txt *.vsd *.css *.cs *.cpp *.bak *.php *.js *.json *.doc* *.sql *.xls* *.xml *.java *.py *.log *.rtf *.htm? *.msg *.eml *.gz *.zip) do if exist "%%x" move /-Y "%%x" %newdir%
for %%x in ( *.jpg *.pdf *.png *.bmp *.gif ) do if exist "%%x" move /-Y "%%x" Screenshotsif not exist Shortcuts md Shortcutsfor %%x in ( *.lnk *.URL ) do if exist "%%x" move /-Y "%%x" Shortcuts

:set n
:set x
echo end batch file %0
pause

endlocal

Batch: Stop Cortana Memory Hog

Googling for "Microsoft Windows 10 Cortana®" reveal MANY complaints about memory loss. My experience is 28-33% reported by Task Manager even when Cortana's voice listening and response services are DISABLED / "inactive"! The best advice found to-date has been "remove" or "rename it"!

Usually a BAD workaround! Especially since it was IMPOSSIBLE to do it manually.
Therefore this BATCH file is offered with the warning "EXAMPLE only! Do *NOT* attempt this on any computer. This batch file is ONLY OFFERED as an example of the "IF" statement and batch logic flow."

@echo off

rem set statusstring="end of %0"

SET /P ISADMIN=Are you RUNNING THIS AS ADMIN (usually from a shortcut 'RUN AS ADMIN') Y/N: =
if /I NOT "%ISADMIN%"=="Y" goto OOPS
rem KLUDGE to SOLVE MEMORY HOG PROBLEM
rem CORTANA is MICROSOFT's AUDIO LISTENER
rem it can take 20-30% or more of RAM
rem can't MANUALLY RENAME or MOVE it because Task Manager RELOADS it
rem SOLUTION: replace MANUAL steps with BATCH commands

setlocal
rem @echo on

echo step 1 kill SearchUI and rename
IF %ERRORLEVEL% GTR 1 SET ERRSTRING=errlevel%ERRORLEVEL%

for %%x in (ActionUriServer.exe PlacesServer.exe RemindersServer.exe RemindersShareTargetApp.exe SearchUI.exe backgroundTaskHost.exe) do IF EXIST %%x taskkill /T /F /PID %%x

rem taskkill /T /F /PID SearchUI.exe
rem taskkill /T /F /PID backgroundTaskHost.exe

echo step 2 rename folder and/or SearchUI.exe to stop RESTART of Cortana
IF EXIST C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy pushd C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy
IF EXIST SearchUI.exe rename SearchUI.exe zSearchUI.exe
pushd C:\Windows\SystemApps
IF EXIST Microsoft.Windows.Cortana_cw5n1h2txyewy move /Y Microsoft.Windows.Cortana_cw5n1h2txyewy Microsoft.Windows.┬ŻCortana_cw5n1h2txyewy

dir /ad Microsoft.Windows.?C*

GOTO END
:OOPS
set statusstring=RUN AS ADMIN (right click on "%0" and Run As Admin)
echo %statusstring%
:END

echo ....
IF NOT "%ERRSTRING%"=="" echo %ERRSTRING%
ECHO FINISHED BATCH FILE %0
pause
endlocal