Eu acidentalmente alterei a associação do arquivo '.exe com o seguinte script Nullsoft (gerado pelo 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
Suponho que o que eu fiz foi, quando solicitado pela associação de arquivos na ferramenta VB Converter, eu simplesmente prendi o .exe lá, não entendi realmente o que ele estava pedindo (especialmente porque meu programa não tem associações de arquivos) e isso é o resultado. Meu palpite é que o culpado são as seguintes linhas:
# Remove file extension to open the program.
DeleteRegKey HKCR ".exe"
DeleteRegKey HKCR "MyProg-Standard file"
Delete /RebootOk "$SMPrograms\MyProg\MyProg.lnk"
Com isso dito, tentei as soluções a seguir.
assoc .exe=exefile
funcionou para mim em um PC (o que eu estava testando a instalação). Mas não funcionou no computador que compilou o script NSIS e aquele que está executando o meu ambiente de desenvolvimento. Nesse caso, ao tentar corrigir o problema, acredito que selecionei o Notepad para ser o programa padrão para abrir .exe
arquivos na minha pressa para resolver o problema. Agora, todo programa abre com o Bloco de Notas (eu até abri o Bloco de Notas com o Bloco de Notas). Executar assoc .exe=exe
nesse PC não tem efeito, mesmo que a execução de assoc .exe
e ftype exefile
retornem os resultados corretos ( .exe=exefile
e exefile="%1" %*
respectivamente). Alguém pode me ajudar a restaurar a funcionalidade padrão do Windows em relação a arquivos EXE?
--- EDIT ---
Para esclarecer, esta não é uma duplicata de esta questão , eu tentei (como administrador) e não fez nada.