0
I accidentally changed the `.exe file association with the following Nullsoft script (generated by VBConverter)
# MyProg-Standard.nsi installation script
# Automatically generated by VB6Converter by David Nuttall
# VB6Converter was compiled on 15/02/08
#
Name "MyProg-Standard-Setup"
OutFile "MyProg-Standard-Setup.exe"
RequestExecutionLevel admin
SetCompress auto
SetCompressor /SOLID /FINAL Lzma
WindowIcon on
AutoCloseWindow false
SetDatablockOptimize on
CRCCheck on
InstProgressFlags smooth
SetDateSave on
AllowSkipFiles on
SetOverwrite IfNewer
InstallDir "$ProgramFiles\MyProg"
!include Library.nsh
Page Directory
Page Components
Page InstFiles
Var ALREADY_INSTALLED
Var Version
Section "MyProg-Standard"
SectionIn 1 RO
;LogSet on # Needs special build of NSIS to actually work.
# Change the registry structure to reflect the directory structure you are using.
ReadRegDWord $Version HKLM "Software\VBGenerator\MyProg-Standard" Version
IfErrors new_installation
StrCpy $ALREADY_INSTALLED 1
new_installation:
SetOutPath "$InstDir"
File /a "Support\license.txt"
!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\mesa.dll" "$SysDir\mesa.dll" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\cwui.ocx" "$SysDir\cwui.ocx" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\MSWINSCK.OCX" "$SysDir\MSWINSCK.OCX" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\cwanalysis.ocx" "$SysDir\cwanalysis.ocx" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\comct332.ocx" "$SysDir\comct332.ocx" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\MSCOMM32.OCX" "$SysDir\MSCOMM32.OCX" "$SysDir"
!insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED \
"Support\RICHED32.DLL" "$SysDir\RICHED32.DLL" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\RICHTX32.OCX" "$SysDir\RICHTX32.OCX" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\mscomct2.ocx" "$SysDir\mscomct2.ocx" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\MSCOMCTL.OCX" "$SysDir\MSCOMCTL.OCX" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\comdlg32.ocx" "$SysDir\comdlg32.ocx" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\TABCTL32.OCX" "$SysDir\TABCTL32.OCX" "$SysDir"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\USB_DLL.dll" "$SysDir\USB_DLL.dll" "$SysDir"
SetOutPath "$InstDir"
File /a "Support\MyProg_NXPUSB.exe"
# Put shortcuts in the start menu
CreateDirectory "$SMPrograms\MyProg"
CreateShortCut "$SMPrograms\MyProg\MyProg.lnk" "$InstDir\MyProg_NXPUSB.exe"
WriteRegDWord HKLM "Software\VBGenerator\MyProg-Standard" Version 1
WriteUninstaller "$InstDir\uninstaller.exe"
CreateShortCut "$SMPrograms\Uninstall MyProg-Standard.lnk" "C:\svn\projects\Standard_MyProg_NXPUSB\GUI\REV_M_Hardware\SWD0015-XXX\Package (3)\uninstaller.exe"
# Set file extension to open the program.
WriteRegStr HKCR ".exe" "" "MyProg-Standard file"
WriteRegStr HKCR "MyProg-Standard file" "" "MyProg-Standard Document"
WriteRegStr HKCR "MyProg-Standard file\DefaultIcon" "" "$InstDir\MyProg_NXPUSB.exe,1"
WriteRegStr HKCR "MyProg-Standard file\shell\open\" "" "&Open"
WriteRegStr HKCR "MyProg-Standard file\shell\open\command" "" '"$InstDir\MyProg_NXPUSB.exe" "$$1"'
# Add uninstaller information to registry.
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyProg-Standard" "DisplayName" "MyProg-Standard"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyProg-Standard" "UninstallString" '"$InstDir\uninstaller.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyProg-Standard" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyProg-Standard" "NoRepair" 1
SectionEnd
Section Uninstall
# Remove file extension to open the program.
DeleteRegKey HKCR ".exe"
DeleteRegKey HKCR "MyProg-Standard file"
Delete /RebootOk "$SMPrograms\MyProg\MyProg.lnk"
UnRegDLL "$InstDir\MyProg_NXPUSB.exe"
Delete /RebootOk "$InstDir\MyProg_NXPUSB.exe"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\USB_DLL.dll"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\TABCTL32.OCX"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\comdlg32.ocx"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\MSCOMCTL.OCX"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\mscomct2.ocx"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\RICHTX32.OCX"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\RICHED32.DLL"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\MSCOMM32.OCX"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\comct332.ocx"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\cwanalysis.ocx"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\MSWINSCK.OCX"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\cwui.ocx"
!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\mesa.dll"
Delete /RebootOk "$InstDir\license.txt"
Delete /RebootOk "$SMPrograms\\Uninstall .lnk"
RMDir "$SMPrograms\"
DeleteRegKey HKLM "Software\VBGenerator\MyProg-Standard"
SetOutPath "\" ;Change to root directory to allow the next step to succeed.
RmDir /RebootOk "$INSTDIR"
SectionEnd
Section "-Install VB6 runtimes"
;Add code here that sets $ALREADY_INSTALLED to a non-zero value if"
;the application is already installed. For example:
IfFileExists "C:\svn\projects\Standard_MyProg_NXPUSB\GUI\REV_M_Hardware\SWD0015-XXX\Package (3)\MyProg-Standard.nsi.exe" 0 new_installation2
StrCpy $ALREADY_INSTALLED 1
new_installation2:
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"Support\msvbvm60.dll" "$SYSDIR\msvbvm60.dll" "$SYSDIR"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\oleaut32.dll" "$SYSDIR\oleaut32.dll" "$SYSDIR"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\olepro32.dll" "$SYSDIR\olepro32.dll" "$SYSDIR"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\comcat.dll" "$SYSDIR\comcat.dll" "$SYSDIR"
!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\asycfilt.dll" "$SYSDIR\asycfilt.dll" "$SYSDIR"
!insertmacro InstallLib TLB $ALREADY_INSTALLED REBOOT_PROTECTED \
"Support\stdole2.tlb" "$SYSDIR\stdole2.tlb" "$SYSDIR"
SectionEnd
Section "-un.Uninstall VB6 runtimes"
!insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\msvbvm60.dll"
!insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\oleaut32.dll"
!insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\olepro32.dll"
!insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\comcat.dll"
!insertmacro UnInstallLib DLL SHARED NOREMOVE "$SYSDIR\asycfilt.dll"
!insertmacro UnInstallLib TLB SHARED NOREMOVE "$SYSDIR\stdole2.tlb"
SectionEnd
I suppose what I did was, when prompted for the file association in the VB Converter tool, I just stuck .exe in there, not really understanding what it was asking for (especially since my program has no file associations) and this is the result. My guess is that the culprit are the following few lines:
# Remove file extension to open the program.
DeleteRegKey HKCR ".exe"
DeleteRegKey HKCR "MyProg-Standard file"
Delete /RebootOk "$SMPrograms\MyProg\MyProg.lnk"
With that said, I tried the following solutions.
- I tried the solution presented here which had seemingly no effect.
- I tried a couple of the solutions here as well. EthanAD's solution did nothing for me either. However, running
assoc .exe=exefile
did work for me on one PC (the one which I was testing the installation on). But it did not work on the computer which compiled the NSIS script and the one running my development environment. On that one, in trying to fix the issue, I believe I selected Notepad to be the default program for opening.exe
files in my haste to solve the problem. Now, every program opens with Notepad (I even opened Notepad itself with Notepad). Runningassoc .exe=exe
on that PC has no effect, even though runningassoc .exe
andftype exefile
return the correct results (.exe=exefile
andexefile="%1" %*
respectively).
Can somebody help me restore default Windows functionality with regards to EXE files?
--- EDIT ---
To clarify, this is not a duplicate of this question, I've tried it (as an admin) and it did nothing.
@Ramhound I've already done that. I actually got the steps I've tried from that question. I linked to the Microsoft site, however, so that the steps I tried wouldn't ve confused with other answers. – audiFanatic – 2018-01-24T19:41:42.600
Yes, of course. I've rebooted every time I've tried a fix – audiFanatic – 2018-01-24T21:12:22.947
@Ramhound They're not contradictions because the first couple "duplicates" you flagged me for were, in fact, not duplicates. You were just looking for brownie points with the mods, you didn't want to help. If you wanted to help, you would have linked to an answer, I would have said "yes that worked" or "no, that didn't work," and then in the former case, THEN you would have flagged me as being duplicate. This is a forum for constructive discussion, this is not constructive discussion, this is brownie point hunting. – audiFanatic – 2018-01-24T22:14:38.293
I didn’t read external sources. I knew what the solution was. Turns out I was right. Enjoy your day. you lost no reputation with this question by the way.
– Ramhound – 2018-01-24T22:30:21.260Many ways to skin the cat, sometimes you have to try more then one knife, because the first knife didn’t skin the cat completely doesn’t mean I didn’t know what had to be accomplished. I have referred to that registry file about a hundred times over the last 6 years in comments I have made. It’s “alll of the above type solution” – Ramhound – 2018-01-24T22:47:23.633
Very well, but again, you don't flag it as duplicate until it actually is a duplicate. You don't bring somebody to court on various fictitious charges until one sticks. That's not how the justice system works in any civilized country, nor most of the uncivilized ones either. Why should it work that way on the internet? – audiFanatic – 2018-01-25T03:36:47.650
The first thing I did was flag it as a duplicate. It wouldn’t have been closed as a duplicate until 4 other people agreed with me or a moderator (or gold badge user) agreed with me. – Ramhound – 2018-01-25T08:23:16.870