|
Answer» In a DIRECTORY I have:
shortcut to ctrl-1.txt.lnk shortcut to Desktop.lnk shortcut to Gmail.txt.lnk shortcut to Kohn.txt.lnk shortcut to Netflix updates Android app.txt.lnk shortcut to psw.txt.lnk shortcut to temp.txt.lnk
I would like to remove the "shortcut to " in front of every shortcut link. Yes, I COULD don it by hand quicker than waiting for a reply. But still, I would lie to know how to do it.That way in the future I could use a batch batch to remove the unwanted part of the name. Please? Code: [Select]:: This TURNS off the path and stuff, makes it look purdy @echo off :: Allows us to change variables while in a for loop using "!" instead of "%" setlocal EnableDelayedExpansion
:: This gets us a list of all the .lnk files and loops through each, performing everything withing the parenthises to each. for /f "delims=" %%A in ('dir /b ^| find ".lnk"') do ( :: Sets the variable a to the current file, allowing use to use the variable MANIPULATION tools in batch set a=%%A :: Resets a to the value of a without the first 12 characters set a=!a:~12! :: This renames the file to the new name (without the "Shortcut to ") echo rename "%%A" "!a!" :: Close the loop ) :: Pause the program to allow the USER to check for errors pause
Remove "echo" if it is what you want. If you need any help on the syntax of anything don't be afraid to ask, "for /f" can be very picky. Lemonilla, thanks. I will try it asap. Kooks good.The powertoy in XP can turn off the creation of that 'shortcut to' prefix too.
|