Last active
September 23, 2016 21:06
-
-
Save LoghamLogan/7d2c1bf1ec6db73e9de025297cc64ddc to your computer and use it in GitHub Desktop.
Renames all .lnk files in the current directory to BLANK (ALT+255) strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM ********************************************************************************************************************** | |
REM DISCLAIMER: THIS SCRIPT IS PROVIDED "AS IS" AND I TAKE NO RESPONSIBILITY FOR ANY DAMAGES THAT MAY OCCUR IF YOU USE IT. | |
REM ********************************************************************************************************************** | |
REM ** What is this? ** | |
REM This script will rename all .lnk files within the local directory to 'blank' names. | |
REM ** Why? ** | |
REM I use this so I don't have to keep track of how many <ALT+255> characters I need to put when renaming my desktop icons! | |
REM When this is used in conjunction with a registry hack to remove shortcut icon arrows it provides a cleaner desktop feeling. (http://www.howtogeek.com/howto/windows-vista/disable-shortcut-icon-arrow-overlay-in-windows-vista/) | |
REM ** IMPORTANT ** | |
REM If you are getting weirdly named files then this file has been edited using the wrong encoding for your system. | |
REM Use OEM850 (Western Europe -> OEM850 in notepad++) and replace the strblank variable to be: strblank=<ALT+255 HERE>. It should look like this: set "strblank= " | |
REM I have commented at that line so it is easy to find! | |
REM ********************************************************************************************************************** | |
REM We need the below to enable RANDOM and !variables! | |
setlocal EnableExtensions EnableDelayedExpansion | |
set "pattern=.\*.lnk" | |
REM list local lnk files | |
echo. | |
echo Finding .lnk files... | |
for %%f in (%pattern%) do ( | |
@echo Found: %%f | |
) | |
REM Ask if user wants to continue | |
:Ask | |
echo. | |
echo Would you like to rename all the .lnk files above to blank names? | |
set INPUT= | |
set /P INPUT=(Y/N): %=% | |
If /I "%INPUT%"=="y" goto yes | |
If /I "%INPUT%"=="n" goto no | |
echo Unrecognised Input & goto Ask | |
EXIT /B | |
:yes | |
REM Set random names as a lazy way to avoid collisions | |
for %%f in (%pattern%) do ( | |
rename "%%f" "!RANDOM!.lnk" | |
) | |
REM Set as _blank_ names (ALT+255). | |
setlocal EnableDelayedExpansion | |
REM *** v STRBLANK MUST EQUAL ALT+255 IN OEM850 encoding v *** | |
set "strblank= " | |
REM *** ^ STRBLANK MUST EQUAL ALT+255 IN OEM850 encoding ^ *** | |
set "str1=%strblank%" | |
for %%f in (%pattern%) do ( | |
REM @echo %%f | |
rename "%%f" "!str1!.lnk" | |
set "str1=!str1!%strblank%" | |
) | |
echo. | |
echo Finished renaming .lnk files! \0/ | |
echo. | |
EXIT /B | |
:reghack | |
REM Registry changes for to remove shortcut arrows | |
REM todo: Embed Blank.ico file? | |
REM REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" /f /v 29 /t REG_SZ /d "C:\Windows\Blank.ico,0" | |
EXIT /B | |
:no | |
echo. | |
echo OK. Bye Bye! 0/ | |
echo. | |
EXIT /B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment