How to reset shortcuts (.lnk file) in Windows 7?
Solution 1
Open regedit
from the Start Menu (You can also invoke the file using Run command).
Navigate to the following registry branch:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.lnk
Click on the arrow to expand it and delete the sub-key named UserChoice
.
Exit from Registry Editor.
After this do a reboot.
Solution 2
Follow these steps to save the Registry code below into a .reg
file then import it into the Registry:
- Open Notepad
- Copy and paste the Registry code below into the Notepad window
- Save the file to your Desktop with the name fixshortcuts.reg
- On your Desktop open fixshortcuts.reg and merge the file into the Registry
- Log off and back on to make the changes take effect
Windows Registry Editor Version 5.00
;LNK file association fix for Windows Vista.
;Updated on April 24, 2007
[HKEY_CLASSES_ROOT\.lnk]
@="lnkfile"
[HKEY_CLASSES_ROOT\.lnk\ShellEx]
[HKEY_CLASSES_ROOT\.lnk\ShellEx\{000214EE-0000-0000-C000-000000000046}]
@="{00021401-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\.lnk\ShellEx\{000214F9-0000-0000-C000-000000000046}]
@="{00021401-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\.lnk\ShellEx\{00021500-0000-0000-C000-000000000046}]
@="{00021401-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\.lnk\ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
@="{00021401-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\.lnk\ShellNew]
"Handler"="{ceefea1b-3e29-4ef1-b34c-fec79c4f70af}"
"IconPath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\
74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,\
00,68,00,65,00,6c,00,6c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,\
31,00,36,00,37,00,36,00,39,00,00,00
"ItemName"="@shell32.dll,-30397"
"MenuText"="@shell32.dll,-30318"
"NullFile"=""
"Command"=-
[HKEY_CLASSES_ROOT\.lnk\ShellNew\Config]
"DontRename"=""
[HKEY_CLASSES_ROOT\lnkfile]
@="Shortcut"
"EditFlags"=dword:00000001
"FriendlyTypeName"="@shell32.dll,-4153"
"NeverShowExt"=""
"IsShortcut"=""
[HKEY_CLASSES_ROOT\lnkfile\CLSID]
@="{00021401-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\lnkfile\shellex]
[HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers]
[HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers\OpenContainingFolderMenu]
@="{37ea3a21-7493-4208-a011-7f9ea79ce9f5}"
[HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers\{00021401-0000-0000-C000-000000000046}]
@=""
[HKEY_CLASSES_ROOT\lnkfile\shellex\DropHandler]
@="{00021401-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\lnkfile\shellex\IconHandler]
@="{00021401-0000-0000-C000-000000000046}"
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.lnk\UserChoice]
Solution 3
The extension .lnk
is associated with the Lnkfile which is more commonly known as a Shortcut.
To repair the misassociation, open a Command Prompt and type:
assoc.lnk=lnkfile
Press Enter and you should be good to go.
Solution 4
A system restore to before the problem started will fix it, and likely any other file association changes.
Thank god for system restore points. I don't know a direct fix, but I'm back up and running.
If you can't fix it with a scalpel, try a sledgehammer.
Related videos on Youtube
gcalan
Updated on September 17, 2022Comments
-
gcalan over 1 year
For an assignment, I had to code a due date which is 30 days after the invoice date. When I run my program, I'm not getting a correct date. I'm not sure what I did wrong. Any help would be appreciated.
Code from class that creates and formats due date:
// a method that returns the due date public Date getDueDate() { Date dueDate = new Date(invoiceDate.getTime() + (30 * 24 * 60 * 60 * 1000)); return dueDate; } // a method that returns the formatted due date public String getFormattedDueDate() { DateFormat shortDueDate = DateFormat.getDateInstance(DateFormat.SHORT); return shortDueDate.format(this.getDueDate()); }
Code from main class which calls the getFormattedDueDate:
public static void displayInvoices() { System.out.println("You entered the following invoices:\n"); System.out.println("Number\tTotal\tInvoice Date\tDue Date"); System.out.println("------\t-----\t------------\t--------"); double batchTotal = 0; int invoiceNumber = 1; while (invoices.size() > 0) { Invoice invoice = invoices.pull(); System.out.println(invoiceNumber + "\t " + invoice.getFormattedTotal() + " " + invoice.getFormattedDate() + "\t " + invoice.getFormattedDueDate()); invoiceNumber++; batchTotal += invoice.getInvoiceTotal(); }
-
wallyk over 12 yearsWhat result did you get? What result did you expect?
-
gcalan over 12 yearsThe invoice date is today and I expected 3/15/12. The date returned is 1/25/12
-
gcalan over 12 yearsA poster on coderanch provided me the answer. I thought I'd add it here in case anyone else has a similar problem. In the calculation which adds 30 days to the invoice date, it should read: "(30L * 24 * 60 * 60 * 1000)". I tested it and this indeed worked. I'm not sure what the "L" accomplished but will look it up.
-
John3136 over 12 yearsL forces the literal number to be long instead of int. the expression comes out at 0x9A7EC800 (showing in hex so you can see that top most bit is set) - in an int that is your sign bit, so the expression has "overflowed" and the quick fix is to do it as a long instead of an int.
-
gcalan over 12 yearsThanks, John3136. That makes sense.
-
just mike about 6 yearshunkid0ry's answer below fixed the problem immediately -- no reboot, no logout/login -- and is one step
-
-
UNK over 14 yearsIf you can't fix it with a sledgehammer, you're not hitting it hard enough!
-
Robin Winslow over 11 yearsThat is amazing. You are amazing. It worked like a charm. (After I logged off and on again).
-
humphrey about 11 yearsYou the star for the day 100% worked for me
-
Guillaume Chevalier almost 10 yearsYou can even restart explorer.exe instead of rebooting.
-
Nathan Hartley almost 10 yearsThis answer is correct if it was only the user's preference that was affected. Otherwise, the HKEY_CLASSES_ROOT\.lnk registry key will need to be rebuilt, as mentioned in another answer.
-
ppostma1 over 9 yearsThat worked instantly to repair damage left behind by malware
-
user1603548 over 9 yearsGot the message "The specified file is not a registry script. You can only import binary registry files from within the registry editor." I createt a txt file in C:/Users/jl/ and pasted the code and renamed the file to .reg
-
user1603548 over 9 yearsI navigated to "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.lnk" please note the \ in the end. This is what I see link to three screenshots. Should I delete allt hat are not Named "(Default)"?
-
Jsncrdnl about 9 yearsYou saved my day !
-
thiagolr almost 9 yearsThere is a similar question on the Microsoft KB and their solution doesn't work! This answer is better than theirs! =)
-
Gao over 8 yearsOr just log off and then back in. No reboot is required for this.
-
Tensigh over 7 yearsThis is a great tip, I'd buy you a beer/coffee if I could.
-
8vtwo over 2 yearsTHANK YOU SO MUCH