Page 1 of 1

How to get .ext ftype into variable

Posted: 24 Sep 2019 00:34
by hlhp
I want to create a batch to change extensions icon without chaning the ftype.

I can find ftype by

Code: Select all

assoc .png
output is

Code: Select all

.gif=Honeyview.gif
How can I extract the Honeyview.gif to a variable, then I can use it change the registry.

Re: How to get .ext ftype into variable

Posted: 24 Sep 2019 01:52
by penpen
You may use a "for/f"-loop (untested):

Code: Select all

@echo off
setlocal enableExtensions disableDelayedExpansion
for /f "tokens=* delims==" %%a in ('assoc .png') do set "%%~a"

echo(.png=%.png%
goto :eof
penpen

Re: How to get .ext ftype into variable

Posted: 24 Sep 2019 03:59
by hlhp
penpen wrote:
24 Sep 2019 01:52
thank you penpen, it works.
I modified a little bit

Code: Select all

@echo off
FOR /F "delims== tokens=2" %%G IN ('assoc .gif') DO set temp1=%%G
echo %temp1%
pause