VMware Horizon Community
CharlesOfTempe
Contributor
Contributor

ThinApp Sandbox Cleaning Tool

Hello -

I have been using ThinApps for almost two years, and have deployed a number of them to virtual and physical machines.  The first and best troubleshooting step is to clear out the sandbox if a ThinApp has problems running when they previously worked.  The next problem is helping the user to navigate to the correct folder on the computer to clear out the sandbox.

I have written a batch file that lists the sandbox folders and can delete them, one by one, if desired.  This has been tested and works with Windows XP and Windows 7.

DISCLAIMER: The code below is provided "as is", without warranty.  The user assumes all risk and liability for it's use, and is solely responsible for any loss or damage incurred to their environment or equipment.

With that being said, copy and paste the code below into a new text file document.  Rename the document to something like "sbclean.cmd", making sure that the file name has a ".cmd" extension, not ".txt" or ".doc".

Important Note:  Make sure that no ThinApps are running when you run the sandbox cleaning tool.

Thank you and enjoy.

Charles

@ECHO OFF

rem     sbclean.cmd - ThinApp Sandbox Cleaner - December 2012

SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
rem     Make the Thinstall folder the working directory for this session

IF NOT EXIST %AppData%\Thinstall GOTO Empty

PUSHD %AppData%\Thinstall
:menuLOOP
CLS
rem     Check to see if any folders exist
DIR .\ |FIND "<DIR>" |FIND /n ":" |FIND "[3]" > NUL
IF %ERRORLEVEL% EQU 1 GOTO Empty
ECHO.
ECHO.
ECHO  The following ThinApp sandboxes were found:
ECHO.
ECHO.
rem     Write a list of the folders to a file
DIR .\ /b /AD > sblist.txt
rem     Write a list of the folders to the screen
SET /a count=0
FOR /d %%A in (*) do (
    SET /a count+=1
    @ECHO !count! %%A
)
rem     Choose what to do
SET choice=
ECHO.&SET /p choice=Enter the NUMBER of the ThinApp folder to delete, or press ENTER to quit: ||GOTO:END
SET /a counter=1
rem     Match the number chosen to the item in the list
FOR /f "usebackq delims=" %%B in (sblist.txt) do (
    IF !counter! EQU %choice% RD /q /s "%%B"
    SET /a counter+=1
)
rem     Delete the chosen sandbox folder and return to the beginning
GOTO:menuLOOP
rem     If there are no folders found display the message below
:Empty
ECHO.
ECHO.
ECHO  There were no ThinApp sandboxes found on this computer.
ECHO.
ECHO.
ECHO                   Press any key to exit.
ECHO.
PAUSE > NUL
rem     Clean up before closing the session
:END
DEL /q sblist.txt
POPD

0 Kudos
1 Reply
Lakshman
Champion
Champion

Charles,

Thanks a ton for your efforts and sharing the script, very much appreciated.

0 Kudos