The only way I could get a dir list was to change the FOR loop. As I do not have a G: drive I used F: instead. The folders V5_Update_20.22.dir, V5_Update_20.23.dir, etc, are in my folder F:\test. See red bold below. The script works when run from anywhere. The echo commands in the loop are just for testing. You can hard-code the parent folder like below or you can make it a %var% or even pass it to the script as a parameter (e.g. %1). Nobody ever answers my batch solutions, so good luck!
@echo off
setlocal enabledelayedexpansion
set max=0
for /f "delims=" %%x in ('dir /ad /b "f:\test\V5_Update_*"') do (
set "FN=%%~nx"
echo FN = !FN!
set "FN=!FN:V5_Update_=!"
echo FN = !FN!
if !FN! GTR !max! set max=!FN!
echo max = !max!
)
echo AUDI library latest version: V5_Update_%max%
pause