-1

so I have 2 files, a zipped file with all my files/folders for a game and a unzipper.bat file that puts everything in the correct place to work.

I decided to use IExpress to make an installer for my game, and there was an option for running a file on installation, so i put setup.bat there thinking that it would run when all the files were installed, but it didnt do that.

how can I make it so that it runs setup.bat ones all the files have been installed?

edit: this i my current SED file

[Version]
Class=IEXPRESS
SEDVersion=3
[Options]
PackagePurpose=InstallApp
ShowInstallProgramWindow=0
HideExtractAnimation=1
UseLongFileName=0
InsideCompressed=0
CAB_FixedSize=0
CAB_ResvCodeSigning=0
RebootMode=I
InstallPrompt=%InstallPrompt%
DisplayLicense=%DisplayLicense%
FinishMessage=%FinishMessage%
TargetName=%TargetName%
FriendlyName=%FriendlyName%
AppLaunched=%AppLaunched%
PostInstallCmd=%PostInstallCmd%
AdminQuietInstCmd=%AdminQuietInstCmd%
UserQuietInstCmd=%UserQuietInstCmd%
SourceFiles=SourceFiles
[Strings]
InstallPrompt=Are you sure you want to install Block Dodger?
DisplayLicense=
FinishMessage=Thank you for installing Block Dodger.
TargetName=C:\Users\Gebruiker\Desktop\Block Dodger (installer).EXE
FriendlyName=Block Dodger installer
AppLaunched=cmd.exe /c unzipper.bat
PostInstallCmd=%SystemRoot%\System32\cmd.exe /C unzipper.bat
AdminQuietInstCmd=
UserQuietInstCmd=
FILE0="Block_Dodger.zip"
FILE1="unzipper.bat"
[SourceFiles]
SourceFiles0=C:\Users\Gebruiker\Desktop\
[SourceFiles0]
%FILE0%=
%FILE1%=

when i run the installer it gives the following error: error

the batch file which couldnt be found (shortcut_creator.bat) is in the zipped file unzipper.bat is supposed to unzip.

this is the content of unzipper.bat:

@echo off
setlocal
cd /d %~dp0
Call :UnZipFile "%~dp0" "%~dp0Block_Dodger.zip"
exit /b

:UnZipFile <ExtractTo> <newzipfile>
set vbs="%temp%\_.vbs"
if exist %vbs% del /f /q %vbs%
>%vbs%  echo Set fso = CreateObject("Scripting.FileSystemObject")
>>%vbs% echo If NOT fso.FolderExists(%1) Then
>>%vbs% echo fso.CreateFolder(%1)
>>%vbs% echo End If
>>%vbs% echo set objShell = CreateObject("Shell.Application")
>>%vbs% echo set FilesInZip=objShell.NameSpace(%2).items
>>%vbs% echo objShell.NameSpace(%1).CopyHere(FilesInZip)
>>%vbs% echo Set fso = Nothing
>>%vbs% echo Set objShell = Nothing
cscript //nologo %vbs%
if exist %vbs% del /f /q %vbs%

del /f /q "%~dp0Block_Dodger.zip"

start /d "%~dp0Block_Dodger" shortcut_creator.bat

edit 2: i just checked the box "Store files using Long Files names inside Package" and it does work now, the only thing left now is how do i change where the files end up?

Bjorn
  • 103
  • 12
  • Does this answer your question? [How can a .bat file be 'converted' to .exe without third party tools?](https://stackoverflow.com/questions/28174386/how-can-a-bat-file-be-converted-to-exe-without-third-party-tools) – Squashman Mar 29 '21 at 13:00
  • it kind of does, ended up making another batch file that creates a directory in appdata end moves the not temp files there. – Bjorn Mar 29 '21 at 13:24
  • I guess you're on "edit 2". The path were the batch unzip the files is `"%~dp0"`, which means the path were the batch script is. Did you need a hand to rewrite unzipper.bat with a parametrized path for unzip ? – Zilog80 Mar 29 '21 at 14:19
  • @Zilog80 no, thx for the offer but i already fixed my issues. i made a file_mover.bat to create a folder in user/local/appdata and move the zip and unzipper.bat there, then i run unzipper.bat and file_mover.bat deletes itself. – Bjorn Mar 29 '21 at 14:48
  • I suggest you to post *checked the box "Store files using Long Files names inside Package"* as an answer to your question ^^ – Zilog80 Mar 29 '21 at 15:20
  • If you're including a zip file, why bother with IExpress? Just create a self extracting zip file, most SFX tools should include options for commands to run upon extraction, and in doing so will also be able to reference the extracted location, as a basis for your commands. – Compo Mar 29 '21 at 23:23
  • @Compo because i wanted to get familliar with new things like this, and since i dont have any other files that i would be able to use as a test i had to use my game. which was indeed a selfextracting zip file. – Bjorn Mar 30 '21 at 07:10
  • Get rid of the self extracting zip file then, and do it all in IExpress. – Compo Mar 30 '21 at 10:43
  • well, i would love to but i haven't had the time yet to learn how to make it so that the files can stay in the folders. thats why i did it this way, just to get to know iexpress a bit. any other sugestions for changes? – Bjorn Mar 30 '21 at 14:00

2 Answers2

0

In your SED file, the PostInstallCmdshould be set as :

PostInstallCmd="%SystemRoot%\System32\cmd.exe /C setup.bat"
Zilog80
  • 2,534
  • 2
  • 15
  • 20
  • i pasted it in to the SED file and changed setup.bat to my actual file name. but it still doesnt work, i just edited the post and added my SED file. could you have a look at it? – Bjorn Mar 29 '21 at 11:25
0

i fixed it by checking the box "Store files using Long Files names inside Package"

you can also do it by going to the SED file and setting

UseLongFileName=0

to

UseLongFileName=1
Bjorn
  • 103
  • 12