@echo off IF "%1"=="/h" ( echo syntax: %0 [/y] [/h] echo /y = continue without pausing for prompts goto :EOF ) IF "%1"=="/y" ( set SKIP=1 ) ELSE ( set SKIP=0 ) echo HP Smart Update Manager cached data delete script echo - echo Removing HP SUM cache files will require re-entering echo all baseline locations, nodes and credentials. echo - echo This script should not be run while HP SUM is running. echo - REM Look for HP SUM processes. Returns '0' if found, '1' if not found tasklist | find "hpsum" if %errorlevel% EQU 0 ( echo - echo ======================================================== echo WARNING: HP SUM instances were found currently running. echo Please exit HP SUM using Logout and shutdown from the echo browser running HP SUM or use 'hpsum shutdownengine' echo before calling clean-cache to prevent file conflicts. echo ======================================================== echo - REM This is now only a warning because it might be a script or other process with hpsum in the name (SIM) REM goto end ) IF %SKIP%==1 goto oktodelete set /p ok="Are you sure you want to delete HP SUM cache files? [y or n] : " if "%ok%"=="y" goto oktodelete echo Exiting without deleting any files. goto end :oktodelete IF EXIST %temp%\HPSUM ( IF EXIST %temp%\HPSUM\baseline ( echo Removing %temp%\HPSUM\baseline rmdir /s /Q %temp%\HPSUM\baseline ) ELSE ( echo %temp%\HPSUM\baseline already deleted. ) FOR %%J IN ( hpsum.pdb hpsum.pdb-wal hpsum.pdb-shm hpsum_remote.pdb ) DO ( FOR /F "usebackq" %%I in (`dir /s /b %temp%\HPSUM ^| find "%%J"`) DO ( echo Removing %%I erase /Q %%I ) ) FOR /F "usebackq" %%P IN (`dir /ad /b %temp%\HPSUM ^| findstr /B /R ._._._.`) DO ( echo Removing directory %temp%\HPSUM\%%P rmdir /S /Q %temp%\HPSUM\%%P ) ) ELSE ( echo No HP SUM temp directory found to delete. (%temp%\HPSUM) ) :end IF %SKIP%==0 ( pause )