Second setup is executed too early and not wait that first Setup finished

1

This is my Self extractor script:

;Il commento che segue contiene dei comandi per lo script del modulo auto-
estraente

Setup="uTorrent quick installer\Install.bat"
Setup="%COMSPEC%" /c RD /s /q "uTorrent quick installer" 2> NUL
Silent=1

The contens of this batch file is not relevant. This is the installation file:

@echo off
setlocal EnableExtensions DisableDelayedExpansion
CD "uTorrent quick installer"
:Inizio
TASKLIST | FINDSTR uTorrent.exe > NUL 2> NUL
IF %ERRORLEVEL%==0 (
cls
echo Chiudere uTorrent per far partire l'installazione...
timeout /t 1 /nobreak > NUL
goto Inizio
)
cls
IF NOT DEFINED PROGRAMFILES(X86) (set "PROGRAMFILES(X86)=%PROGRAMFILES%")
set MESSAGGIO1=0
set MESSAGGIO2=0
IF NOT EXIST "%USERPROFILE%\Desktop\Torrent da importare" (set MESSAGGIO1=1)
IF EXIST "%APPDATA%\uTorrent\*.torrent" (
set MESSAGGIO2=1
XCOPY /q /y "%APPDATA%\uTorrent\*.torrent" "%USERPROFILE%\Desktop\Torrent da importare\" > NUL
)
IF EXIST "%PROGRAMFILES(X86)%\uTorrent\*.torrent" (
set MESSAGGIO2=1
XCOPY /q /y "%PROGRAMFILES(X86)%\uTorrent\*.torrent" "%USERPROFILE%\Desktop\Torrent da importare\" > NUL
)
DEL /q "%USERPROFILE%\Desktop\uTorrent.lnk" 2> NUL
DEL /q "%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\uTorrent.lnk" 2> NUL
syspin.exe "%APPDATA%\uTorrent\uTorrent.exe" c:5387 > NUL
RD /s /q "%PROGRAMFILES(X86)%\uTorrent" 2> NUL
RD /s /q "%APPDATA%\uTorrent" 2> NUL
XCOPY /e /q /y uTorrent "%PROGRAMFILES(X86)%\uTorrent\" > NUL
Shortcut.exe /f:"%USERPROFILE%\Desktop\uTorrent.lnk" /a:c /t:"%PROGRAMFILES(X86)%\uTorrent\uTorrent.exe" > NUL
Shortcut.exe /f:"%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs/uTorrent.lnk" /a:c /t:"%PROGRAMFILES(X86)%\uTorrent\uTorrent.exe" > NUL
syspin.exe "%PROGRAMFILES(X86)%\uTorrent\uTorrent.exe" c:5386 > NUL
echo Applicazione installata.
IF %MESSAGGIO2%==1 (
IF %MESSAGGIO1%==1 (
echo E' stata creata la cartella "Torrent da importare" sul Desktop.
timeout /t 2 /nobreak > NUL
) ELSE (
echo E' stato aggiornato il contenuto della cartella sul Desktop "Torrent da importare".
timeout /t 3 /nobreak > NUL
)
)
timeout /t 2 /nobreak > NUL
start "" "%PROGRAMFILES(X86)%\uTorrent\uTorrent.exe"
endlocal

(This batch work perfectly).

Riccardo La Marca

Posted 2017-07-30T17:25:59.237

Reputation: 163

Answers

1

I am solved it!!!

;Il commento che segue contiene dei comandi per lo script del modulo auto-estraente

Path="%TEMP%"
Setup="uTorrent quick installer\Install.bat"
Setup="%COMSPEC%" /c RD /s /q "uTorrent quick installer" 2> NUL
Setup="%COMSPEC%" /c start "" "%PROGRAMFILES(X86)%\uTorrent\uTorrent.exe"
SetupCode
Silent=1

This is the batch file:

@echo off
setlocal EnableExtensions DisableDelayedExpansion
CD "uTorrent quick installer"
:Inizio
TASKLIST | FINDSTR uTorrent.exe > NUL 2> NUL
IF %ERRORLEVEL%==0 (
cls
echo Chiudere uTorrent per far partire l'installazione...
timeout /t 1 /nobreak > NUL
goto Inizio
)
cls
IF NOT DEFINED PROGRAMFILES(X86) (set "PROGRAMFILES(X86)=%PROGRAMFILES%")
set MESSAGGIO1=0
set MESSAGGIO2=0
IF NOT EXIST "%USERPROFILE%\Desktop\Torrent da importare" (set MESSAGGIO1=1)
IF EXIST "%APPDATA%\uTorrent\*.torrent" (
set MESSAGGIO2=1
XCOPY /q /y "%APPDATA%\uTorrent\*.torrent" "%USERPROFILE%\Desktop\Torrent da importare\" > NUL
)
IF EXIST "%PROGRAMFILES(X86)%\uTorrent\*.torrent" (
set MESSAGGIO2=1
XCOPY /q /y "%PROGRAMFILES(X86)%\uTorrent\*.torrent" "%USERPROFILE%\Desktop\Torrent da importare\" > NUL
)
DEL /q "%USERPROFILE%\Desktop\uTorrent.lnk" 2> NUL
DEL /q "%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\uTorrent.lnk" 2> NUL
syspin.exe "%APPDATA%\uTorrent\uTorrent.exe" c:5387 > NUL
RD /s /q "%PROGRAMFILES(X86)%\uTorrent" 2> NUL
RD /s /q "%APPDATA%\uTorrent" 2> NUL
XCOPY /e /q /y uTorrent "%PROGRAMFILES(X86)%\uTorrent\" > NUL
Shortcut.exe /f:"%USERPROFILE%\Desktop\uTorrent.lnk" /a:c /t:"%PROGRAMFILES(X86)%\uTorrent\uTorrent.exe" > NUL
Shortcut.exe /f:"%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs/uTorrent.lnk" /a:c /t:"%PROGRAMFILES(X86)%\uTorrent\uTorrent.exe" > NUL
syspin.exe "%PROGRAMFILES(X86)%\uTorrent\uTorrent.exe" c:5386 > NUL
echo Applicazione installata.
IF %MESSAGGIO2%==1 (
IF %MESSAGGIO1%==1 (
echo E' stata creata la cartella "Torrent da importare" sul Desktop.
timeout /t 2 /nobreak > NUL
) ELSE (
echo E' stato aggiornato il contenuto della cartella sul Desktop "Torrent da importare".
timeout /t 3 /nobreak > NUL
)
)
timeout /t 2 /nobreak > NUL
endlocal

Riccardo La Marca

Posted 2017-07-30T17:25:59.237

Reputation: 163