MSFN Forum: [HowTo] WinRAR-SFX Installer/Uninstaller - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

Welcome to the Applications Installs forum. Make sure you read the forum rules before you start posting.

Links/Requests to warez and/or any illegal material (porn, cracks, serials, etc..) will not be tolerated. Discussion of circumventing WGA/activation/timebombs/keygens or any other illegal activity will also not be tolerated.

We try our best to keep this forum clean of illegal content. If you see any illegal activity use the "report" button you find in every post to report the specific post to the moderators. If you ignore any of the rules you will be banned without notice.

Read Forum Rules
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[HowTo] WinRAR-SFX Installer/Uninstaller A single EXE to install and uninstall Rate Topic: -----

#1 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 04 September 2006 - 03:57 AM

WinRAR-SFX Installer/Uninstaller.
Example: Bulk Rename Utility.

STEP 1: Files to be added to the SFX.

I downloaded the zipped version of BRU because I like customization :-)

I take out these files from the downloaded archive:

1- Bulk Rename Utility.exe
2- BRU_XP.dll
3- pcre.dll
4- Bulk Rename Utility.chm
5- Changelog.rtf
6- Readme.rtf
7- Tips.txt

I put the extracted files in C:\BRU.

STEP 2: Reg file for tweaks, if necessary.

I create BRUtweak.reg to configure BRU prior to the first use.
This is the content of BRUtweak.reg:

 
REGEDIT4

[HKEY_CURRENT_USER\Software\Jim Willsher\BULK RENAME UTILITY\Main Window]
"AlwaysOnTop"=dword:00000000
"WindowPlacement"="1,37,800,536,3,2"
"Col Name"=dword:000000a0
"Col NewName"=dword:000000a0
"Col SubDir"=dword:00000028
"Col Type"=dword:00000032
"Col Size"=dword:00000028
"Col Created"=dword:00000032
"Col Modified"=dword:00000032
"Col New Length"=dword:00000032
"Col Time Taken"=dword:00000032
"Col Attributes"=dword:00000032

[HKEY_CURRENT_USER\Software\Jim Willsher\BULK RENAME UTILITY\Preferences]
"Favourite Path"=""
"Auto Save Favourite On Exit"=dword:00000000
"Store Favourite Pathnames"=dword:00000000
"Display Icons"=dword:00000001
"Highlight Active Criteria"=dword:00000001
"Display Warning Message"=dword:00000001
"Display Confirmation Message"=dword:00000001
"Display Gridlines"=dword:00000001
"Full Row Select"=dword:00000000
"Overwrite Target Files"=dword:00000000
"New Location Copy Not Move"=dword:00000000
"Auto Select Entries"=dword:00000000
"Ignore Folder Extensions"=dword:00000001
"Change Attributes H"=dword:00000000
"Change Attributes A"=dword:00000001
"Change Attributes R"=dword:00000001
"Colour New Name OK"=dword:00008004
"Colour New Name Invalid"=dword:000000ff
"Colour Active Criteria Back"=dword:00000080
"XP Sorting"=dword:00000001
"Sort Column"=dword:00000000
"Sort Dir"=dword:00000001

[HKEY_CURRENT_USER\Software\Jim Willsher\BULK RENAME UTILITY\Tip]
"FilePos"=dword:0000020c
"StartUp"=dword:00000000 


As you can see, there are three main keys in BRUtweak.reg! They are:

[HKEY_CURRENT_USER\Software\Jim Willsher\BULK RENAME UTILITY\Main Window]
[HKEY_CURRENT_USER\Software\Jim Willsher\BULK RENAME UTILITY\Preferences]
[HKEY_CURRENT_USER\Software\Jim Willsher\BULK RENAME UTILITY\Tip]


Actually, and after using the program itself,
an additional key is written to the Registry. It is:

[HKEY_CURRENT_USER\Software\Jim Willsher\BULK RENAME UTILITY\Settings]

Well, that's actually no problem because deleting the key "Jim Willsher" will
delete the subkeys, too. This task is assigned to BRUunins.cmd as you'll see below.

STEP 3: Batch file for perfecting installation and uninstallation.

I create BRUtweak.cmd to:

1- run BRUtweak.reg then delete it.
2- Write uninstall strings to the Registry.
3- create BRUunins.cmd!

BRUunins.cmd will uninstall BRU when you press "Remove" in "Control Panel-->Add or Remove Programs".

Both BRUtweak.cmd and BRUunins.cmd are self-deleted.

This is the content of BRUtweak.cmd: (you just copy/paste)

BRUtweak.cmd said:

@echo off
CD >NUL
:: Applying BRUtweak.reg ------------------------------------------- (1)
REGEDIT /S BRUtweak.reg
del BRUtweak.reg
:: Writing Uninstall strings to the Registry ----------------------- (2)
SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\BRU
REG ADD %KEY% /v DisplayName /d "Bulk Rename Utility 2.2.5.0"
REG ADD %KEY% /v DisplayIcon /d "%SystemDrive%\Program Files\Bulk Rename Utility\Bulk Rename Utility.exe"
REG ADD %KEY% /v UninstallString /d BRUunins.cmd
REG ADD %KEY% /v DisplayVersion /d 2.2.5.0
REG ADD %KEY% /v Publisher /d "Jim Willsher"
REG ADD %KEY% /v URLInfoAbout /d http://www.BulkRenameUtility.co.uk
REG ADD %KEY% /v HelpLink /d http://www.BulkRenameUtility.co.uk
REG ADD %KEY% /v URLUpdateInfo /d http://www.BulkRenameUtility.co.uk
REG ADD %KEY% /v NoModify /t REG_DWORD /d 1
REG ADD %KEY% /v NoRepair /t REG_DWORD /d 1
:: Creating BRUunins.cmd ------------------------------------------- (3)
echo @echo off>%SystemRoot%\BRUunins.cmd
echo CD>>%SystemRoot%\BRUunins.cmd
echo :: Deleting BRU directory from Program Files>>%SystemRoot%\BRUunins.cmd
echo RD /S /Q "%%SystemDrive%%\Program Files\Bulk Rename Utility">>%SystemRoot%\BRUunins.cmd
echo :: Deleting BRU shortcut folder from Start Menu>>%SystemRoot%\BRUunins.cmd
echo RD /S /Q "%%UserProfile%%\Start Menu\Programs\Bulk Rename Utility">>%SystemRoot%\BRUunins.cmd
echo :: Deleting BRU reg tweaks from the Registry>>%SystemRoot%\BRUunins.cmd
echo REG DELETE "HKCU\Software\Jim Willsher" /f>>%SystemRoot%\BRUunins.cmd
echo :: Deleting BRU uninstall strings from the Registry>>%SystemRoot%\BRUunins.cmd
echo REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\BRU /f>>%SystemRoot%\BRUunins.cmd
echo :: Deleting BRUunins.cmd (oh! that's me! OOPS!)>>%SystemRoot%\BRUunins.cmd
echo del %%0>>%SystemRoot%\BRUunins.cmd
:: Deleting BRUtweak.cmd (oh! that's me! OOPS!) -------------------- (4)
del %0


STEP 4: Creating the SFX.

Well! So far, we've got 9 files. They are:

1- Bulk Rename Utility.exe
2- BRU_XP.dll
3- pcre.dll
4- Bulk Rename Utility.chm
5- Changelog.rtf
6- Readme.rtf
7- Tips.txt
8- BRUtweak.reg
9- BRUtweak.cmd

Assuming the 9 files are in C:\BRU, we do the following to create our SFX:

01- Open WinRAR. Browse to C:\BRU where you keep the 9 files.
02- Use your expertise with the keyboard and mouse to highlight (select) the 9 files.
03- Go to "Commands" menu. Select "Add files to archive". The "Archive name and parameters" dialog
box should appear with the "General" tab activated.
04- Tick "Create SFX archive" and "Create solid archive".
05- In the "Archive name" field, change the suggested name given by WinRAR to BRU.exe then
choose "Best" from the "compression method" combo box.
06- Go to "Advanced" tab. Press "SFX options". The "Advanced SFX options" dialog box appears
with the "General" tab activated.
07- In the "Path to extract" field, type "Bulk Rename Utility" without quotes.
-- This means that the package (SFX) will be extract, during installation, to:
%ProgramFiles%\Bulk Rename Utility.
-- Make sure the "Create in "Program Files"" radio button is selected.
-- Make sure the "Save and restore paths" check box is not checked.
08- In the "Run after extraction" field, type "BRUtweak.cmd" without quotes.
-- As shown in STEP 3, BRUtweak.cmd is necessary to be run after extraction to perform some tasks.
09- Still in the "Advanced SFX options" dialog box, press the "Advanced" tab.
-- Press the "Add shortcut..." button. The "Add shortcut" dialog box appears.
-- Select "Start Menu/Programs". In the "Source file name" field, type "Bulk Rename Utility.exe"
without quotes. This is the name of the file you create a shortcut to.
-- In the "Destination folder" field, type "Bulk Rename Utility" without quotes.
This is the name of the shortcut folder that will be created under:
%UserProfile%\Start Menu\Programs.
-- In the "Shortcut description" field, type
"Bulk Rename Utility - Renames multiple files on the fly!" without quotes.
-- In the "Shortcut name" field, type "Bulk Rename Utility" without quotes.
This is the link that will appear as:
%UserProfile%\Start Menu\Programs\Bulk Rename Utility\Bulk Rename Utility.lnk
-- Now, press "Ok" to return back to the "Advanced" tab.
++ Repeat the same steps again to create two more shortcuts; one for "Bulk Rename Utility.chm"
and one for "Readme.rtf".
10- Still in the "Advanced SFX options" dialog box, press the "Modes" tab.
-- Under "Silent mode", select "Hide all". This tells the SFX not to show setup screens.
-- Under "Overwrite mode", select "Overwrite all files". This tells the SFX to overwrite any files
pre-existing in the destination folder %ProgramFiles%\Bulk Rename Utility, if there's any.
11- Press "Ok" on the "Advanced SFX options" dialog box to close.
-- Press "Ok" on the "Archive name and parameters" dialog box and wait for the compression
process to finish. BRU.exe is now created in C:\BRU.
12- Move BRU.exe to a safe place on your harddisk as you'll use it to install BRU afterwards.
-- Delete the folder C:\BRU as it's no longer needed.

STEP 5: Installing BRU from your UAXPCD.

Since you configured the SFX (BRU.exe) to install silently (Hide all) you don't need to add switches
on the command line when installing BRU. Simply, you install it this way:

start /wait %SystemDrive%\Install\BRU.exe

This assumes that BRU.exe is put in %SystemDrive%\Install at the time of installation.
Otherwise, change the path to your own.

Note: Save time when creating a SFX.

Steps from 07 through 10 are summarized here:

Comment said:

Path=Bulk Rename Utility
Setup=BRUtweak.cmd
Silent=1
Overwrite=1
Shortcut=P, "Bulk Rename Utility.exe", "Bulk Rename Utility", "Bulk Rename Utility - Renames multiple files on the fly!", "Bulk Rename Utility"
Shortcut=P, "Bulk Rename Utility.chm", "Bulk Rename Utility", "Bulk Rename Utility Help", "Help"
Shortcut=P, "Readme.rtf", "Bulk Rename Utility", "Info about BRU", "Read Me"

This summary is called "Comment".

Actually, if you have this comment in hand, you can ignore Steps from 07 through 10.
In Step 06, go to the "Comment" tab directly instead of going to the "Advanced" tab.
In the "Enter a comment manually" field, just paste the above Comment, then press "Ok".
You're done!

Attached File(s)

  • Attached File  BRU.JPG (26.6K)
    Number of downloads: 244

This post has been edited by mazin: 21 September 2006 - 07:39 PM



#2 User is offline   mzar720 

  • Junior
  • Pip
  • Group: Members
  • Posts: 78
  • Joined: 30-December 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 04 September 2006 - 04:31 PM

Great work... Thanks Mazin for this usefull guide.

#3 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 04 September 2006 - 04:47 PM

You're welcome.

#4 User is offline   Dumpy Dooby 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 424
  • Joined: 16-May 05

Posted 06 September 2006 - 08:54 AM

I prefer 7z SFX because of the custom dialog box. However, the uninstall script will come in handy. Thanks a bunch. :)

#5 User is offline   chikky 

  • Newbie
  • Group: Members
  • Posts: 13
  • Joined: 02-September 06

Posted 06 September 2006 - 09:45 PM

Very useful tips, mazin. Thanks

#6 User is offline   kulmegil 

  • Group: Members
  • Posts: 7
  • Joined: 08-August 04

Posted 12 September 2006 - 10:08 AM

Quote

%%UserProfile%%\Start Menu\Programs\Bulk Rename Utility
Unfortunately, this will work only for English ver of Windows.
For example, in Polish it's gonna be:

Quote

%%UserProfile%%\Menu Start\Programy\Bulk Rename Utility


Overall, it's a very good guide... I love simple winrar/7z simple installers, but uninstall always seem to be a problem here...

This post has been edited by kulmegil: 12 September 2006 - 10:12 AM


#7 User is offline   MGadAllah 

  • Brain Voice
  • PipPipPipPipPip
  • Group: Banned
  • Posts: 786
  • Joined: 03-January 06

Posted 12 September 2006 - 10:13 AM

Thanks mazin
Really great work

#8 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 12 September 2006 - 01:30 PM

View Postkulmegil, on Sep 12 2006, 07:08 PM, said:

but uninstall always seem to be a problem here...

If there's a problem, I can help.

@ mgadallah

You're welcome.

#9 User is offline   Takeshi 

  • Legitchecking...
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,107
  • Joined: 09-September 04

Posted 19 September 2006 - 05:43 PM

mazin: I have a few queries if you don't mind as I'm not familiar with this.

1. HKLM uninstall reg keys, is there any reason to have to use REG ADD, rather than simply REG IMPORT (or regedit /s) uninstall.reg?

2. This prog doesn't come with uninstaller, so you have to write your own cmd?

3. How about the dlls, would it be necessary to unregister them?

4. What are the 3 shortcuts in SFX arguments?

5. What steps do I have to take to make the SFX in WinRAR?

Oh I like that comment: oh! that's me! OOPS! :P

Thanks as always :hello:

#10 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 20 September 2006 - 05:25 PM

Q1. HKLM uninstall reg keys, is there any reason to have to use REG ADD, rather than simply REG IMPORT (or regedit /s) uninstall.reg?

A1. Yes, there's a reason. Here it is:

REG ADD %KEY% /v DisplayIcon /d "%SystemDrive%\Program Files\Bulk Rename Utility\Bulk Rename Utility.exe"

Since I use REG ADD, the path will be written to the Registry this way:

"DisplayIcon"="C:\\Program Files\\Bulk Rename Utility\\Bulk Rename Utility.exe"

If my %SystemDrive% is D:, the path will be written to the Registry this way:

"DisplayIcon"="D:\\Program Files\\Bulk Rename Utility\\Bulk Rename Utility.exe"

So, whatever my %SystemDrive% is, it will be translated correctly using REG ADD.

This is apparently useful when I install this package on a computer without knowing its %SystemDrive% in advance.

But, if you want to use an absolute path, then you can use REGEDIT /S uninstall.reg instead.

Knowing your %SystemDrive% is always C:, your uninstall.reg should appear like this:

uninstall.reg said:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\BRU]
"DisplayName"="Bulk Rename Utility 2.2.5.0"
"DisplayIcon"="C:\\Program Files\\Bulk Rename Utility\\Bulk Rename Utility.exe"
"UninstallString"="BRUunins.cmd"
"DisplayVersion"="2.2.5.0"
"Publisher"="Jim Willsher"
"URLInfoAbout"="http://www.BulkRenameUtility.co.uk"
"HelpLink"="http://www.BulkRenameUtility.co.uk"
"URLUpdateInfo"="http://www.BulkRenameUtility.co.uk"
"NoModify"=dword:00000001
"NoRepair"=dword:00000001

On the other hand, if you are satisfied with the default uninstall icon (see the attached pic),
then you can exclude the "DisplayIcon" line.
This way, you won't need to use REG ADD. You can, then, use a reg file instead.

Well!

You probably noticed that I used: REG ADD %KEY% /v UninstallString /d BRUunins.cmd!

Since I created BRUunins.cmd in %SystemRoot% (see block 3 in BRUtweak.cmd), then its location
is known to the system. %SystemRoot% is a pre-defined path.
Hence, I didn't have to use: REG ADD %KEY% /v UninstallString /d %SystemRoot%\BRUunins.cmd!

But, if you create BRUunins.cmd in a non-defined path, then you'll need to use REG ADD again.

Q2. This prog doesn't come with uninstaller, so you have to write your own cmd?

A2. Yes!

Q3. How about the dlls, would it be necessary to unregister them?

A3. I think you're referring to BRU_XP.dll and pcre.dll!

Well! In your package, if you register a DLL during installation, then you have to unregister it during the uninstallation process.
A DLL does not register by itself. So, if you haven't registered it by yourself, you don't have
to unregister it. Otherwise, you'll get the message "The specified module could not be found".

Q4. What are the 3 shortcuts in SFX arguments?

A4. Those are shortcuts to Bulk Rename Utility.exe, Bulk Rename Utility.chm, and Readme.rtf!
They are created in "%UserProfile%\Start Menu\Programs\Bulk Rename Utility".

Example: Shortcut=P, "Readme.rtf", "Bulk Rename Utility", "Info about BRU", "Read Me"

Where to put a shortcut = P (=%UserProfile%\Start Menu\Programs)
Which file to create a shortcut to = "Readme.rtf"
What folder under P to put the shortcut in = "Bulk Rename Utility"
What description to give to the shortcut = "Info about BRU"
What name to be given to your shortcut = "Read Me"

Eventually, this will create: "%UserProfile%\Start Menu\Programs\Bulk Rename Utility\Read Me.lnk"

Q5. What steps do I have to take to make the SFX in WinRAR?

A5. To be answered, later. First post updated!


Stay tuned.

Attached File(s)

  • Attached File  BRU.GIF (1.76K)
    Number of downloads: 6

This post has been edited by mazin: 21 September 2006 - 07:42 PM


#11 User is offline   Takeshi 

  • Legitchecking...
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,107
  • Joined: 09-September 04

Posted 20 September 2006 - 09:46 PM

Thanks a lot!

Q1. Understood. I missed the environment variable when I read the cmd. In fact I've been using reg for testing the RunOnceEx execution (in the other thread).

Q3. How would you know if you need to register a DLL in the first place?

Q4. I'll try it out in due course. But I don't see in the arguments how or where you specify where to install the prog to.

#12 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 21 September 2006 - 01:31 AM

View PostTakeshi, on Sep 21 2006, 06:46 AM, said:

Q3. How would you know if you need to register a DLL in the first place?

You don't have to worry about that. DLLs in our example (BRU) are built for use with their related EXE.
Since they are (EXE & DLLs) in one folder, the app should work correctly.

View PostTakeshi, on Sep 21 2006, 06:46 AM, said:

Q4. I'll try it out in due course. But I don't see in the arguments how or where you specify where to install the prog to.

This parameter tells the SFX where to install the files: Path=Bulk Rename Utility!
When a path stated this way, a folder in %ProgramFiles% called "Bulk Rename Utility" is created.

And if a folder with the same name already pre-exists in %ProgramFiles%, it will be overwritten
by the parameter: Overwrite=1

The parameter "Silent=1" tells the SFX not to show any setup windows during installation.

Of course, the parameter "Setup=BRUtweak.cmd" tells the SFX what file to launch after extracting
the package.

#13 User is offline   Takeshi 

  • Legitchecking...
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,107
  • Joined: 09-September 04

Posted 21 September 2006 - 03:14 PM

Thanks for your help.

I found other threads on making SFX in WinRAR so I'll read them. I'll post back if there're further questions.

#14 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 21 September 2006 - 07:44 PM

I updated the first post and added a section for creating a SFX.

HTH

#15 User is offline   ontheteam 

  • Group: Members
  • Posts: 2
  • Joined: 29-December 06

Posted 03 September 2009 - 10:50 AM

Is there a way to set a Winrar SFX to require Admin rights?

#16 User is offline   strel 

  • segmentation fault
  • PipPipPipPip
  • Group: Members
  • Posts: 629
  • Joined: 24-February 08
  • OS:XP Pro x86
  • Country: Country Flag

Posted 03 September 2009 - 11:17 AM

I'm thinking of giving a password to the file or using cacls command to set permissions to the file.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

3 User(s) are reading this topic
0 members, 3 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy