How do I get an extension if the filename has two dots?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
PiotrMP006
Posts: 31
Joined: 08 Sep 2017 06:10

How do I get an extension if the filename has two dots?

#1 Post by PiotrMP006 » 16 Aug 2020 09:19

How do I get an extension if the filename has two dots?

ex.

Test.aaa.txt

%~r1 -> aaa.txt

Please help me

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: How do I get an extension if the filename has two dots?

#2 Post by ShadowThief » 16 Aug 2020 09:48

Why would .aaa.txt be the extension instead of just .txt? What if you had A.File.Name.Like.This.2020.HEVC.x265.mkv?

Also, %~r doesn't work because %~r isn't a valid variable substitution command. %~x gets the extension.

Post Reply