Zend certified PHP/Magento developer

How to get filename only without .tar.gz in a batch script

I am creating a batch script where I need to define a variable to initiate a docker shell from Windows command prompt. The script has a user choose their docker image build from their directory but the file is in .tar.gz format. Switching from %~nxI to %~ni in my script only removes the .gz. Do I need to unzip the file to be able to do this or is there another command to copy the name sans the .tar portion to the variable?

Pause
cd /images
setlocal enabledelayedexpansion

set /A counter=0
set choice=

for /R %%i in (iac_*.tar.gz) do (

if not "%%~ni" == "%~nx0" (
set /A counter+=1
echo !counter!: %%~ni
set deployment_builder[!counter!]=%%i

set choice=!choice!!counter!
)
)

if %counter% LSS 10 (
choice /C %choice% /M "type deployment_builder number"
set DEPBUILDNUM=!ERRORLEVEL!
) else set /P DEPBUILDNUM="enter deployment_builder number: "

set DEPLOYMENTBUILDER=!deployment_builder[%DEPBUILDNUM%]!
echo %DEPLOYMENTBUILDER%