|
Answer» Hi All,
While DOWNLOADING a game my son managed to turn .exe files to .exe.lnk. files. Now none of the programs work. Anyone know how to fix this?? There is a batch file fix that can cure this. Had to rely on this in the past for a friends system that somehow tons of files got double file extensions, and only the first extension belonged and the last extension was wrong etc.
A simple
Code: [SELECT] rename *.exe.lnk *.exe will not fix this as I have tried, as for the rename function by itself can only change the last .xxx place holder in the file name, so if you ran rename *.exe.lnk *.lnk you end up with FileName.exe.exe in which now you need to drop one of the .exe's, although the files would probably launch ok now that the file association is met that STATES that its an exe which it is, however the EXTRA .exe is still sloppy, especially if anything calls to the FileName.exe explicitly where FileName.exe.exe would be different and a mismatch.
Here is a solution from this link: http://stackoverflow.com/questions/16486356/batch-file-to-find-files-with-double-file-extensions-and-remove-the-last-one
Code: [Select]ECHO OFF SETLOCAL
SET sourcedir=c:\sourcedir FOR /r "%sourcedir%" %%i IN (*.*) DO ( FOR %%n IN ("%%~ni") DO IF NOT "%%~xn"=="" IF NOT EXIST "%%~dpni" ECHO REN "%%~fi" "%%~ni" FOR %%n IN ("%%~ni") DO IF NOT "%%~xn"=="" IF EXIST "%%~dpni" ECHO CAN NOT REN "%%~fi" "%%~ni" )
GOTO :EOF
Other than this free batch program method, there are also programs out there such as Better File Rename that can correct for problems like this, that come at a cost. http://www.publicspace.net/windows/BetterFileRename/index.html
|