Using batch to make launchers (help needed)

Discuss anything related to command line tools here.
Post Reply
Message
Author
pplknownothin
Posts: 62
Joined: Tue Mar 18, 2008 9:31 am
Location: Maryland:haaha
Contact:

Using batch to make launchers (help needed)

#1 Post by pplknownothin »

alright...
For this example I am using Format Factory which can be found here *http://www.formatoz.com/*
I have 3 folders named "App", "Data", and "Other".
In the App folder I have all the program files.
In the Data folder the registry keys are kept.
In the Other I have the source for the batch file.
And the batch file in outside of all these folder's.

First I found out what registry keys the app used using RegFromApp and decided which ones matter and which ones didn't. Then I saved the Reg file for later use. Then I created this batch file using those registry keys i found.

Batch:

Code: Select all

cd Data
regedit /e "Backup.reg" "HKEY_CURRENT_USER\Software\FormatFactory"
regedit /s "delete.reg"
REGEDIT /s "Settings.reg"
cd %~dp0/app
start /wait FormatFactory.exe
cd %~dp0\Data
regedit /e "Settings.reg" "HKEY_CURRENT_USER\Software\FormatFactory"
regedit /s "delete.reg"
regedit /s "Backup.reg"
If you know anything about batch you will understand what it's doing.
First it create's a backup of the old registry keys then runs "Delete.reg" which looks like this

Code: Select all

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\FormatFactory]
Which deletes the key you just backed up. Then the batch tells it to apply any settings that you may have. It runs the program, waits for it to stop and then when it ends it exports the setting.reg and delete's the registry key and applys the backup key if any.

I then use Quick Batch File Compiler *http://www.abyssmedia.com/quickbfc/* to compile the script to an ghost exe to run it so the console doesn't come up. You can also use Resource Hacker *http://www.angusj.com/resourcehacker/* to get the icon from the original exe.

What I need help with is is there any way to delete folders the program
makes in user documents for both xp and vista, or do I have to use

Code: Select all

%username%\My Documents[/code
and
%username%\Documents
in the same batch?

Also...
Is there a way to backup multiple registry keys to one reg file or do I
have to backup each one individually as backup1.reg, backup2.reg...ect

User avatar
Dagenham
Posts: 8
Joined: Wed Jun 13, 2007 12:36 am
Contact:

NSIS instead of batch

#2 Post by Dagenham »

I suggest You to use the NSIS scripting language instead of dealing with batch files.

On PortableApps.com, You can find many examples - the source code of the launchers is always shipped with the application.

NSIS is not a big deal for someone who is familiar with batch files, and has many possibilities.

pplknownothin
Posts: 62
Joined: Tue Mar 18, 2008 9:31 am
Location: Maryland:haaha
Contact:

#3 Post by pplknownothin »

yeah...i've looked at nsis and never really understood it, mainly because i could never find a good detailed tutorial on how to do stuff. Making a launcher from batch is pretty easy and as far as i can can tell it can do the same stuff as nsis, which I might be wrong. If you have any good tutorials or if you could make one for a beginner send me a link.

User avatar
Local
Posts: 238
Joined: Fri Aug 03, 2007 3:48 am

#4 Post by Local »

I'm pretty much in the same boat as you pplknownothin.
I' e been using batch files for this but unfortunately can't test their usefulness on vista.

I think adding the two delete commands should work, the only problem I can see is if somebody keeps a "documents" folder on XP or vice versa.
If you're only deleting the specific folder though it shouldn't have a problem.

Mixing the reg files together I can't do at all and requested help here a while ago, http://portablefreeware.com/forums/view ... ght=#14076
m^(2) gave me a script to try but so far it's over my head and I haven't had time to sit and try to figure everything out


One major problem I can see with your batch.

extracting the reg and replacing it after is fine, deleting the folders made in My doc's is fine, but are there any settings from previous installations that have to be returned to my doc's?

I believe that with NSIS you could place the items where they were retrieved for but not with DOS

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

Re: Using batch to make launchers (help needed)

#5 Post by m^(2) »

pplknownothin wrote:What I need help with is is there any way to delete folders the program
makes in user documents for both xp and vista, or do I have to use

Code: Select all

%username%\My Documents[/code
and
%username%\Documents
in the same batch?
%userprofile%

Post Reply