@echo off setlocal EnableDelayedExpansion :: ----------- SETTINGS ------------------------------------------------------- :: which extension your videos are? set extensions=avi,mov,wav :: whether to open export folder after renaming set open_exportfolder=true :: whether to delete original mp4 files anyway, even if not files to rename found set del_mp4_anyway=true :: ----------- SETTINGS END ------------------------------------------------- :: path variables set GTAVfolder="%userprofile%\Documents\Rockstar Games\GTA V" set SCfolder="%userprofile%\Documents\Rockstar Games\Social Club" set vidfolder="%localappdata%\Rockstar Games\GTA V\videos\rendered" set evefolder=eve :GetGameFolder if exist %GTAVfolder% ( cd /d %GTAVfolder% for /f "tokens=2 delims=(" %%i in ('type launcher.log ^|find "GTA5.exe)"') do set "gamepath=%%i" if "!gamepath!"=="" ( echo ERROR: COULD NOT DETECT GAMEFOLDER & pause & goto :eof ) set gamepath=!gamepath:for =! set gamepath="!gamepath:\GTA5.exe)=!" if exist !gamepath! ( set "gamefolder=!gamepath!" ) else ( echo ERROR: COULD NOT DETECT GAMEFOLDER & pause & goto :eof ) ) else ( echo Warning: CAN'T FIND GTA USER FOLDER %GTAVfolder% & pause & goto :eof ) :SetEVEFolder set gamefolder=%gamefolder:"=% set EVEfolder="%gamefolder%\EVE" if NOT exist %EVEfolder% echo COULD NOT FIND EVE FOLDER & pause & goto :eof echo EVE folder detected: %EVEfolder% & echo. :GetExportFolder cd /d %EVEfolder% for /f "tokens=3 delims= " %%i in ('type ExtendedVideoExport.ini ^|find "output_folder"') do set "ExportFolder=%%i" echo export folder detected: !ExportFolder! if "!ExportFolder!"=="" ( echo COULD NOT AUTODETECT EXPORT FOLDER & pause & goto :eof ) if not exist !ExportFolder! ( echo EXPORT FOLDER INVALID OR DOESN'T EXIST & pause & goto :eof ) :: set rockstar rendered videos folder cd /d %vidfolder% :: we're using for loop and dir command to sort files by date and get the most recent one for /f "tokens=* delims= " %%A in ( ' dir /b /-p /o:-d /t:w *.mp4 ' ) do ( REM if not "!lastname!"=="" goto :eof set "lastname=%%~nA" goto :Rename ) :: this will only print if there were no mp4 files in the folder echo ------------------------------------------------------------------------------------------------------- echo ERROR: NO MP4 FILES FOUND IN %vidfolder% echo ------------------------------------------------------------------------------------------------------- pause goto :eof :: set the path of your custom extended video export output_folder :Rename cd /d %exportfolder% echo %cd% :: same as before, use for loop and dir to get the most recent file which name starts with EVE, then rename it to the name we stored earlier in !vidname! variable for /f "tokens=* delims= " %%A in ( ' dir /b /-p /o:-d /t:w *.* ' ) do ( if !renamed!==true exit set evefileext=%%~xA set evefilename=%%~nA set evefilename=!evefilename:~0,3! for %%E in (%extensions%) do ( if !evefileext!==.%%E ( if !evefilename!==EVE ( ren "%%A" "!lastname!%%~xA" if !errorlevel!==0 ( CALL :ReportRenameSuccess %%~nxA !lastname!%%~xA ) else ( CALL :ReportRenameFailure %%~nxA ) goto :eof ) ) ) ) :: this will only print if no suitable file (matching the criteria) found echo --------------------------------------------------------------- echo ERROR: NO SUITABLE %extensions% FILES TO RENAME echo --------------------------------------------------------------- if %del_mp4_anyway%==true CALL :Deletemp4 pause goto :eof :ReportRenameFailure echo --------------------------------------------------------------------------------------- echo ERROR echo CAN'T RENAME FILE %1 echo CHECK PERMISSIONS echo --------------------------------------------------------------------------------------- pause goto :eof :ReportRenameSuccess echo --------------------------------------------------------------------------------------- echo RENAMED FILE %1 to %2 echo --------------------------------------------------------------------------------------- CALL :Deletemp4 goto :Finish goto :eof :Finish pause if %open_exportfolder%==true explorer %exportfolder% goto :eof :: delete ALL files in the rockstar rendered videos folder :Deletemp4 del %vidfolder%\*.mp4 echo deleted mp4 files goto :eof