A bunch of Win7 fixes

Moderators: b1o, jkerr82508

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

A bunch of Win7 fixes

Postby Snorkasaurus » 07 Dec 2014, 15:59

Greetings Earthlings,

I am doing my best to avoid the switch from XP to 7 but am finding that it is getting harder these days. Of course there are the obvious reasons to make the change, like Microsoft's broken version of Security Essentials and soon it'll be Office 2003. There are also mainstream non-Microsoft apps that are jumping on board as well, like Profile. So if I am going to be forced in to the change, I figure I should try to remove as much of the "ugly" as I can.

I am using NSIS to make a little "installer" that will make a bunch of changes to Win7 to make it seem less like a giant steaming pile of crap. For example I plan to have it remove "Libraries" and "Favorites" from Windows Explorer, and I'll probably also include 7tt to get rid of the "Show Desktop" button that won't leave the systray. I am looking for other suggested changes you guys would like to see... what DON'T you like about Windows 7 (that don't involve installing XP)? :-)

S.

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: A bunch of Win7 fixes

Postby viking60 » 07 Dec 2014, 21:16

NSIS looks interesting, I did not know about that one.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: A bunch of Win7 fixes

Postby Snorkasaurus » 07 Dec 2014, 23:25

viking60 wrote:NSIS looks interesting, I did not know about that one.

It is pretty cool... I have been using it to write "wrappers" for installs. Basically I got tired of installing apps and then spending forever configuring them, so my "wrapper" will do a silent install of an app and then configure my typical preferences for me. Here's an example:

Code: Select all

; Snorkified 7-Zip v9.20 x86 NSIS Script
;--------------------------------
   ; Setup the installer environment
Name "7-Zip x86"
OutFile "..\..\Installs\Snorkified\Snorkified_7-Zip_x86.exe"
InstallDir "C:\Apps\7-Zip"
RequestExecutionLevel admin

Section "Installer"
   ; General environment for installer
SetDetailsView Show
SetOutPath $TEMP
   ; Ask if user wants to install the application
MessageBox MB_ICONEXCLAMATION|MB_YESNO|MB_TOPMOST "Do you wish to install 7-Zip v9.20 in $INSTDIR?$\r$\nIf you click yes the installer will proceed with no further questions." IDYES doinstall IDNO donotinstall

doinstall:
   ; Drop temp file(s)
File files\7z920-x86.msi
File files\7-zip_prefs.reg
   ; Run the installer silently
ExecWait 'msiexec /i "$TEMP\7z920-x86.msi" /qn INSTALLDIR="C:\Apps\7-Zip"'

   ; Backup and Remove Add/Remove Programs entries
ExecWait 'reg export "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{23170F69-40C1-2701-0920-000001000000}" "$INSTDIR\uninst1.reg"'
ExecWait 'reg export "HKEY_LOCAL_MACHINE\Software\Classes\Installer\Products\96F071321C0410729002000010000000" "$INSTDIR\uninst2.reg"'
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\{23170F69-40C1-2701-0920-000001000000}"
DeleteRegKey HKLM "Software\Classes\Installer\Products\96F071321C0410729002000010000000"

   ; Put new entries in Add/Remove Programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "DisplayName" "Snorkified 7-Zip v1.2"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "DisplayVersion" "1.2"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "DisplayIcon" "$INSTDIR\7zFM.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "Publisher" "Snorkasaurus"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "HelpLink" "http://snork.freehostia.com/golink/snorkification/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "Comments" "This application was installed via a Snorkified script!"

   ; Registry entries for preferences
ExecWait "reg import $TEMP\7-zip_prefs.reg"

   ; Write the uninstaller
WriteUninstaller "$INSTDIR\uninst.exe"
   ; Refresh icon cache
Call RefreshShellIcons

donotinstall:

SectionEnd

Section "Uninstall"
SetOutPath $TEMP
SetDetailsView Show
   ; Ask if user wants to remove the application
MessageBox MB_ICONEXCLAMATION|MB_YESNO|MB_TOPMOST "Do you really wish to remove 7-Zip?" IDYES doremove IDNO donotremove

doremove:
   ; First close the application
Execwait '"taskkill" /IM 7z.exe'
Execwait '"taskkill" /IM 7zfm.exe'
Execwait '"taskkill" /IM 7zg.exe'
   ; Restore the reg entries that were backed up during install
ExecWait 'reg import "$INSTDIR\uninst1.reg"'
ExecWait 'reg import "$INSTDIR\uninst2.reg"'
   ; Now silently run the original uninstaller
ExecWait "msiexec /X{23170F69-40C1-2701-0920-000001000000} /QN"
   ; Remove install directory
RMDir /r "$INSTDIR"
   ; Remove remaining registry entries
DeleteRegKey HKCU "Software\7-Zip"
DeleteRegKey HKLM "Software\7-Zip"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip"
DeleteRegKey HKLM "Software\Classes\.7z"
DeleteRegKey HKLM "Software\Classes\.zip"
DeleteRegKey HKLM "Software\Classes\7-Zip.7z"
DeleteRegKey HKLM "Software\Classes\7-Zip.zip"
DeleteRegKey HKLM "Software\Classes\Applications\7zFM.exe"
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Installer\Folders" "$INSTDIR\"

Goto removerend

donotremove:
DetailPrint "Installation cancelled!"

removerend:
SectionEnd
Function RefreshShellIcons
   ; I stole this function from Jerome Tremblay - April 2003
System::Call "shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
FunctionEnd
Function un.RefreshShellIcons
   ; I stole this function from Jerome Tremblay - April 2003
System::Call "shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
FunctionEnd

I also don't like spaces in my paths so I put them all in "C:\Apps\AppName" instead of under "Program Files". This gives me a single .exe that I can run, I get one warning, and then it is installed/configured with no further interaction. Happily, Notepad++ has a syntax highlighter for NSIS as well (though I should change it to show single-quotes with a different background color because it is sometimes hard to see).

My idea for the "Win7Fixer" is to just get rid of as many default irritants as I can and make Win7 as lean as I can. That reminds me, I have to add "Disable Homegroup" to the list. :-)

S.


Return to “Win News”