@echo off
setlocal EnableDelayedExpansion
::net file to test privileges, 1>NUL redirects output, 2>NUL redirects errors
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto START ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' ( goto START )
set "batchPath=%~f0"
set "batchArgs=ELEV"
::Add quotes to the batch path, if needed
set "script=%0"
set script=%script:"=%
IF '%0'=='!script!' ( GOTO PathQuotesDone )
set "batchPath=""%batchPath%"""
:PathQuotesDone
::Add quotes to the arguments, if needed.
:ArgLoop
IF '%1'=='' ( GOTO EndArgLoop ) else ( GOTO AddArg )
:AddArg
set "arg=%1"
set arg=%arg:"=%
IF '%1'=='!arg!' ( GOTO NoQuotes )
set "batchArgs=%batchArgs% "%1""
GOTO QuotesDone
:NoQuotes
set "batchArgs=%batchArgs% %1"
:QuotesDone
shift
GOTO ArgLoop
:EndArgLoop
::Create and run the vb script to elevate the batch file
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
echo UAC.ShellExecute "cmd", "/c ""!batchPath! !batchArgs!""", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B
:START
::Remove the elevation tag and set the correct working directory
IF '%1'=='ELEV' ( shift /1 )
cd /d %~dp1
:: .... your code start ....
::chcp 1252
::chcp 65001
setlocal
call :setESC
title Video and Audio Cutter with FFMPEG
cls
::GET FILENAME AND EXTENSION FROM %1 DRAG AND DROP FILE
::set _filename=%~n1
::set _extension=%~x1
set filedir="%~dp1"
set filename="%~nx1"
::echo Dosya Tam Yolu ve Adı: %1 <<<ÖNEMSİZ
echo Dosya Adı: "%~nx1"
echo Dosya Klasörü: "%~dp1"
::echo Bat Konumu: "%~dp0" <<<ÖNEMSİZ
echo %ESC%[42mÜstteki isimleri kontrol ediniz.%ESC%[0m
echo %ESC%[45mDosya adında veya yolunda TR veya OKUNAMAYAN KARAKTER varsa değiştirin.%ESC%[0m
endlocal
:kesim
set /p cutsstime=Kesime başlanacak zamanı gir (00:00:00) veya saniye cinsinden sayı (1,2,3 vb.):
set /p cutttime=Ne kadar uzunlukta kesileceğini gir (00:00:00) veya saniye cinsinden sayı (1,2,3 vb.):
echo Kesime başlanacak zaman: %cutsstime%
echo Kesilecek uzunluk: %cutttime%
:secim
set /P c=Hata var mı [E/H]?
if /I "%c%" EQU "E" goto :kesim
if /I "%c%" EQU "H" goto :cevirsinmi
goto :secim
:cevirsinmi
set /P h=Convert edilecek mi [E/H]?
if /I "%h%" EQU "E" goto :convertet
if /I "%h%" EQU "H" goto :convertetme
goto :cevirsinmi
:convertet
C:\ffmpeg\bin\ffmpeg.exe -ss %cutsstime% -t %cutttime% -i "%~nx1" -c:v libx264 -c:a aac "%~n1_CUTTED.mp4"
goto :bitti
:convertetme
C:\ffmpeg\bin\ffmpeg.exe -ss %cutsstime% -t %cutttime% -i "%~nx1" -vcodec copy -acodec copy "%~n1_CUTTED%~x1"
goto :bitti
::C:\ffmpeg\bin\ffmpeg.exe -ss %cutsstime% -t %cutttime% -i "%~nx1" -vcodec copy -acodec copy "%~n1_CUTTED%~x1" <<<< ÇALIŞIYOR AMA TR KARAKTERSİZ
::C:\ffmpeg\bin\ffmpeg.exe -ss %cutsstime% -t %cutttime% -i "%1" -vcodec copy -acodec copy "%~n1_CUTTED%~x1"
::C:\ffmpeg\bin\ffmpeg.exe -ss %cutsstime% -t %cutttime% -i "%1" -vcodec copy -acodec copy "%~n1_CUTTED%~x1" <<<< ÇALIŞIYOR AMA BİTİŞİK VE BOŞLUKSUZ
::C:\ffmpeg\bin\ffmpeg.exe -ss %cutsstime% -t %cutttime% -i "%1" -vcodec copy -acodec copy %~n1_CUTTED%~x1 <<<< ÇALIŞIYOR AMA BİTİŞİK VE BOŞLUKSUZ İSİM
::C:\ffmpeg\bin\ffmpeg.exe -ss %cutsstime% -t %cutttime% -i "%1" -vcodec copy -acodec copy %filedir%%~n1_CUTTED%~x1
::C:\ffmpeg\bin\ffmpeg.exe -ss %cutsstime% -t %cutttime% -i "%1" -vcodec copy -acodec copy "%1_CUTTED%~x1" <<<< ÇALIŞIYOR AMA BİTİŞİK VE BOŞLUKSUZ İSİM ve İNPUT KLASÖRÜNDE
::C:\ffmpeg\bin\ffmpeg.exe -ss %cutsstime% -t %cutttime% -i "%1" -vcodec copy -acodec copy "%~n1"_CUTTED"%~x1" <<<< ÇALIŞIYOR AMA BİTİŞİK VE BOŞLUKSUZ İSİM
:bitti
pause
:setESC
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set ESC=%%b
exit /B 0
)
exit /B 0