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=exefiledid 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.exefiles in my haste to solve the problem. Now, every program opens with Notepad (I even opened Notepad itself with Notepad). Runningassoc .exe=exeon that PC has no effect, even though runningassoc .exeandftype exefilereturn the correct results (.exe=exefileandexefile="%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.