Re: Making Filenames Mirror One Another With Different Extensions

Zaidy036 <[email protected]> Mon, 10 Jan 2022 17:42:26 -0500
Newsgroups alt.comp.editors.batch,alt.comp.lang.shell.batch.enhancements,alt.comp.lang.shell.batch.msdos,alt.comp.lang.shell.batch.winnt,alt.msdos.batch,alt.msdos.batch.nt
Organization A noiseless patient Spider
Message-ID <[email protected]>
On 1/17/2016 5:20 PM, AlleyCat wrote:
> 
> Hello all. I think this will be simple for you batch and script gurus, but
> it's driving me crazy.
> 
> Videofile:	House.S08E18.Body And Soul.mkv
> 
> Subtitle:	House.S08E18.HDTV.XviD-LOL.srt
> 
> If you please... copy text after third period (or whatever will be before
> the extension in other cases) of videofile and copy it to the srt file, so
> both files are identical other than the extension.
> 
> Sample:	House.S08E18.Body And Soul.mkv
> 		House.S08E18.Body And Soul.srt
> 
> Not all vid files are in this "format", but I'll work on it from there.
> 
> Thank you so very much.
> 
Substitution works for you:

SET Title="House.S08E18.Body And Soul.mkv"
SET Title2="%Title:~0,-3%srt
    then
Echo Title2
    gives
House.S08E18.Body And Soul.srt