[code autolinks=”false”]
@rem *************************************************************
@rem * MS-DOS batch file to create another file name extension   *
@rem * associated with an application, and rename existing files *
@rem *                                                           *
@rem * dupext.bat v2014.06.12                                    *
@rem * http://malwaremusings.com/scripts/dupext.bat              *
@rem *                                                           *
@rem * usage: dupext.bat [-r] <currentextension> <newextension>  *
@rem * where <currentextension> is the extension to duplicate    *
@rem * and <newextension> is the extension that you want to      *
@rem * create.                                                   *
@rem *************************************************************
@echo off
if "%1" == "-r" goto undoassoc
if "%1" == "" goto usage
if "%2" == "" goto usage
for /f "delims== tokens=2 usebackq" %%a in (`assoc %1`) do assoc %2=%%a
goto rename
:undoassoc
shift
if "%1" == "" goto usage
if "%2" == "" goto usage
assoc %1=
:rename
for /f "delims= usebackq" %%f in (`dir c:\*%1 /s/b`) do ren "%%f" "%%~nf%2"
goto end
:usage
echo "usage: dupext.bat [-r] <currentextension> <newextension>"
:end
[/code]
Pingback: A Document in Sheep’s Clothing | Malware Musings