I currently have a batch file to create an nfo of all file inside a folder. Now I'm looking to add a function for a "single file". i have a part that works but the nfo file text includes the path of the file in the "Complete name" line. I would like to know how to not display this path before the filename. The nfo is currently saved at the location of the file, it should stay that way.
there is the batch file (without the "if single file") : Tx to @Compo for this.
@Echo Off
SetLocal EnableExtensions
Set "MIExe=%UserProfile%\Standalone\MediaInfo\MediaInfo.exe"
Set "OutExt=nfo"
Set "HR=------------------------------------------------------------------"
For %%G In ("%~1") Do If "%%~aG" Lss "d" (If "%%~aG" GEq "-" (
Echo Error! File arg.
GoTo EndIt) Else (Echo Error! Invalid directory arg.
GoTo EndIt)) Else If "%%~dG" == "" (
Echo Error! Full directory path required.
GoTo EndIt)
If Not Exist "%MIExe%" (Echo Error! MediaInfo not found.
GoTo EndIt)
PushD "%~1"
Set "ExtLst="
For %%G In (aac ac3 aifc aiff ape asf au avi avr dat dts flac iff ifo irca m1v
m2v mac mat mka mks mkv mov mp2 mp3 mp4 mpeg mpg mpgv mpv ogg ogm paf pvf qt
ra rm rmvb sd2 sds vob w64 wav wma wmv xi) Do If Not Defined ExtLst (
Set "ExtLst=".":"*.%%G"") Else Call Set "ExtLst=%%ExtLst%% ".":"*.%%G""
Set "}=%PATHEXT%" && Set "PATHEXT="
%SystemRoot%\System32\where.exe /Q %ExtLst%
If ErrorLevel 1 (Echo Error! Directory has no supported files.
GoTo EndIt)
Set "i="
(For /F "Delims=" %%G In ('%SystemRoot%\System32\where.exe %ExtLst% 2^> NUL'
) Do (If Defined i Echo %HR%
"%MIExe%" "%%~nxG"
Set "i=T")) 1> "%~nx1.%OutExt%"
:EndIt
%SystemRoot%\System32\timeout.exe /T 3 /NoBreak 1> NUL
GoTo :EOF
i want to add this part with a if it's a file not folder :
:SingleFile
"%MIExe%" "%~1" > "%~1.%OutExt%"
This work but produce a full path with name at the "Complete name" line..
And i also like to know if the "is a file check" can be use with this part (at the start of the batch) :
...
If "%%~aG" GEq "-" (
Echo Single file.
GoTo SingleFile
...
Thanks in advance for your help !